Changes in directory llvm/lib/Transforms/IPO:
GlobalDCE.cpp updated: 1.42 -> 1.43 --- Log message: Implement aliases. This fixes PR1017: http://llvm.org/PR1017 and it's dependent bugs. CFE part will follow. --- Diffs of the changes: (+12 -1) GlobalDCE.cpp | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/IPO/GlobalDCE.cpp diff -u llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.42 llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.43 --- llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.42 Mon Feb 5 17:32:05 2007 +++ llvm/lib/Transforms/IPO/GlobalDCE.cpp Wed Apr 25 09:27:10 2007 @@ -62,7 +62,8 @@ GlobalIsNeeded(I); } - for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); + I != E; ++I) { Changed |= RemoveUnusedGlobalValue(*I); // Externally visible & appending globals are needed, if they have an // initializer. @@ -72,6 +73,13 @@ } + 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); + } + // Now that all globals which are needed are in the AliveGlobals set, we loop // through the program, deleting those which are not alive. // @@ -135,6 +143,9 @@ // 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 { // 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 _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits