[llvm-commits] CVS: llvm/lib/Transforms/Utils/Linker.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Sep 23 13:14:01 PDT 2002


Changes in directory llvm/lib/Transforms/Utils:

Linker.cpp updated: 1.31 -> 1.32

---
Log message:

Insert resolved constants into the global map so they are reused correctly.
This bug was exposed linking the SPEC benchmark suite.


---
Diffs of the changes:

Index: llvm/lib/Transforms/Utils/Linker.cpp
diff -u llvm/lib/Transforms/Utils/Linker.cpp:1.31 llvm/lib/Transforms/Utils/Linker.cpp:1.32
--- llvm/lib/Transforms/Utils/Linker.cpp:1.31	Tue Aug 20 14:35:11 2002
+++ llvm/lib/Transforms/Utils/Linker.cpp	Mon Sep 23 13:14:15 2002
@@ -81,7 +81,7 @@
 // automatically handle constant references correctly as well...
 //
 static Value *RemapOperand(const Value *In, map<const Value*, Value*> &LocalMap,
-                           const map<const Value*, Value*> *GlobalMap = 0) {
+                           map<const Value*, Value*> *GlobalMap = 0) {
   map<const Value*,Value*>::const_iterator I = LocalMap.find(In);
   if (I != LocalMap.end()) return I->second;
 
@@ -148,7 +148,10 @@
     }
 
     // Cache the mapping in our local map structure...
-    LocalMap.insert(std::make_pair(In, Result));
+    if (GlobalMap)
+      GlobalMap->insert(std::make_pair(In, Result));
+    else
+      LocalMap.insert(std::make_pair(In, Result));
     return Result;
   }
 
@@ -314,7 +317,7 @@
 // function, and that Src is not.
 //
 static bool LinkFunctionBody(Function *Dest, const Function *Src,
-                             const map<const Value*, Value*> &GlobalMap,
+                             map<const Value*, Value*> &GlobalMap,
                              string *Err = 0) {
   assert(Src && Dest && Dest->isExternal() && !Src->isExternal());
   map<const Value*, Value*> LocalMap;   // Map for function local values





More information about the llvm-commits mailing list