[llvm-commits] [llvm] r48259 - /llvm/trunk/lib/Linker/LinkModules.cpp

Anton Korobeynikov asl at math.spbu.ru
Tue Mar 11 15:51:10 PDT 2008


Author: asl
Date: Tue Mar 11 17:51:09 2008
New Revision: 48259

URL: http://llvm.org/viewvc/llvm-project?rev=48259&view=rev
Log:
Ultimately resolve aliases during linking, if possible

Modified:
    llvm/trunk/lib/Linker/LinkModules.cpp

Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=48259&r1=48258&r2=48259&view=diff

==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Tue Mar 11 17:51:09 2008
@@ -1087,11 +1087,10 @@
 
 static bool ResolveAliases(Module *Dest) {
   for (Module::alias_iterator I = Dest->alias_begin(), E = Dest->alias_end();
-       I != E; ++I) {
-    GlobalValue* GV = const_cast<GlobalValue*>(I->getAliasedGlobal());
-    if (!GV->isDeclaration())
-      I->replaceAllUsesWith(GV);
-  }
+       I != E; ++I)
+    if (const GlobalValue *GV = I->resolveAliasedGlobal())
+      if (!GV->isDeclaration())
+        I->replaceAllUsesWith(const_cast<GlobalValue*>(GV));
 
   return false;
 }





More information about the llvm-commits mailing list