[llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalDCE.cpp

Anton Korobeynikov asl at math.spbu.ru
Sat Apr 28 06:45:51 PDT 2007



Changes in directory llvm/lib/Transforms/IPO:

GlobalDCE.cpp updated: 1.43 -> 1.44
---
Log message:

Implement review feedback. Aliasees can be either GlobalValue's or 
bitcasts of them.


---
Diffs of the changes:  (+2 -6)

 GlobalDCE.cpp |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)


Index: llvm/lib/Transforms/IPO/GlobalDCE.cpp
diff -u llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.43 llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.44
--- llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.43	Wed Apr 25 09:27:10 2007
+++ llvm/lib/Transforms/IPO/GlobalDCE.cpp	Sat Apr 28 08:44:59 2007
@@ -75,9 +75,8 @@
 
   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 @@
     // 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






More information about the llvm-commits mailing list