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

Dan Gohman gohman at apple.com
Tue Aug 24 12:37:11 PDT 2010


Author: djg
Date: Tue Aug 24 14:37:11 2010
New Revision: 111949

URL: http://llvm.org/viewvc/llvm-project?rev=111949&view=rev
Log:
Link NamedMDNodes after linking GlobalValues, so that MDNodes
which reference GlobalValues are properly remapped.

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=111949&r1=111948&r2=111949&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Tue Aug 24 14:37:11 2010
@@ -1244,9 +1244,6 @@
       AppendingVars.insert(std::make_pair(I->getName(), I));
   }
 
-  // Insert all of the named mdnoes in Src into the Dest module.
-  LinkNamedMDNodes(Dest, Src, ValueMap);
-
   // Insert all of the globals in src into the Dest module... without linking
   // initializers (which could refer to functions not yet mapped over).
   if (LinkGlobals(Dest, Src, ValueMap, AppendingVars, ErrorMsg))
@@ -1280,6 +1277,11 @@
   // Resolve all uses of aliases with aliasees
   if (ResolveAliases(Dest)) return true;
 
+  // Remap all of the named mdnoes in Src into the Dest module. We do this
+  // after linking GlobalValues so that MDNodes that reference GlobalValues
+  // are properly remapped.
+  LinkNamedMDNodes(Dest, Src, ValueMap);
+
   // If the source library's module id is in the dependent library list of the
   // destination library, remove it since that module is now linked in.
   sys::Path modId;





More information about the llvm-commits mailing list