summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-07-31 00:13:28 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-07-31 00:13:28 +0000
commit9177867b247fb2b5505cb2f349a04cb1b05aa89b (patch)
tree71e8f72dac4ca083203fdef55e1d7024efd05045 /llvm/lib/Bitcode
parente8514fc1f78dc917ed81c8a8112c9d110a1b7c9e (diff)
downloadbcm5719-llvm-9177867b247fb2b5505cb2f349a04cb1b05aa89b.tar.gz
bcm5719-llvm-9177867b247fb2b5505cb2f349a04cb1b05aa89b.zip
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
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r--llvm/lib/Bitcode/Writer/ValueEnumerator.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
index fa1c8b3c57d..2ac53fea8a9 100644
--- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -80,12 +80,15 @@ static OrderMap orderModule(const Module *M) {
// 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
OpenPOWER on IntegriCloud