diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2007-04-28 13:45:00 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2007-04-28 13:45:00 +0000 |
commit | a80e1181b78183dc36ec6568559d38faa86981f0 (patch) | |
tree | 88ca9bd2f28f363e50add28297f6220ac8e09fc1 /lib/Transforms/IPO | |
parent | 44b2c5098f5cf766b4eff43d9eb0d8a9a143e7d8 (diff) | |
download | llvm-a80e1181b78183dc36ec6568559d38faa86981f0.tar.gz llvm-a80e1181b78183dc36ec6568559d38faa86981f0.tar.bz2 llvm-a80e1181b78183dc36ec6568559d38faa86981f0.tar.xz |
Implement review feedback. Aliasees can be either GlobalValue's or
bitcasts of them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36537 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r-- | lib/Transforms/IPO/GlobalDCE.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp index 560bcb56b0..90150689cc 100644 --- a/lib/Transforms/IPO/GlobalDCE.cpp +++ b/lib/Transforms/IPO/GlobalDCE.cpp @@ -75,9 +75,8 @@ bool GlobalDCE::runOnModule(Module &M) { for (Module::alias_iterator I = M.alias_begin(), E = M.alias_end(); I != E; ++I) { - Changed |= RemoveUnusedGlobalValue(*I); // Aliases are always needed even if they are not used. - GlobalIsNeeded(I); + MarkUsedGlobalsAsNeeded(cast<Constant>(I->getAliasee())); } // Now that all globals which are needed are in the AliveGlobals set, we loop @@ -143,10 +142,7 @@ void GlobalDCE::GlobalIsNeeded(GlobalValue *G) { // referenced by the initializer to the alive set. if (GV->hasInitializer()) MarkUsedGlobalsAsNeeded(GV->getInitializer()); - } else if (GlobalAlias *GA = dyn_cast<GlobalAlias>(G)) { - // If this is a global alias we also need it's aliasee - GlobalIsNeeded(const_cast<GlobalValue*>(GA->getAliasee())); - } else { + } else if (!isa<GlobalAlias>(G)) { // Otherwise this must be a function object. We have to scan the body of // the function looking for constants and global values which are used as // operands. Any operands of these types must be processed to ensure that |