On Apr 25, 2007, at 7:28 AM, Anton Korobeynikov wrote: > > > + for (Module::alias_iterator I = M.alias_begin(), E = M.alias_end(); > + I != E; ++I) { > + Changed |= RemoveUnusedGlobalValue(*I);
RemoveUnusedGlobalValue shouldn't be called here. > + // Aliases are always needed even if they are not used. > + GlobalIsNeeded(I); This should mark I->getAliasee() as needed, not the alias. > + } > + > // 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())); If you do the above change, you can delete this hunk. Why do you need the const_cast? -Chris _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits