UseListOrder: Don't give constant IDs to GlobalValues

Since initializers of GlobalValues are being assigned IDs before
GlobalValues themselves, explicitly exclude GlobalValues from the
constant pool.  Added targeted test in `test/Bitcode/use-list-order.ll`
and added two more RUN lines in `test/Assembly`.

This is part of PR5680.

llvm-svn: 214368
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
index fa1c8b3..2ac53fe 100644
--- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -80,12 +80,15 @@
   // implicitly.
   for (const GlobalVariable &G : M->globals())
     if (G.hasInitializer())
-      orderValue(G.getInitializer(), OM);
+      if (!isa<GlobalValue>(G.getInitializer()))
+        orderValue(G.getInitializer(), OM);
   for (const GlobalAlias &A : M->aliases())
-    orderValue(A.getAliasee(), OM);
+    if (!isa<GlobalValue>(A.getAliasee()))
+      orderValue(A.getAliasee(), OM);
   for (const Function &F : *M)
     if (F.hasPrefixData())
-      orderValue(F.getPrefixData(), OM);
+      if (!isa<GlobalValue>(F.getPrefixData()))
+        orderValue(F.getPrefixData(), OM);
   OM.LastGlobalConstantID = OM.size();
 
   // Initializers of GlobalValues are processed in