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

Chris Lattner lattner at cs.uiuc.edu
Mon Oct 6 10:24:02 PDT 2003


Changes in directory llvm/lib/Transforms/Utils:

ValueMapper.cpp updated: 1.4 -> 1.5
InlineFunction.cpp updated: 1.11 -> 1.12

---
Log message:

Avoid doing pointless work.  Amazingly, this makes us go faster.

Running the inliner on 252.eon used to take 48.4763s, now it takes 14.4148s.

In release mode, it went from taking 25.8741s to taking 11.5712s.

This also fixes a FIXME.



---
Diffs of the changes:

Index: llvm/lib/Transforms/Utils/ValueMapper.cpp
diff -u llvm/lib/Transforms/Utils/ValueMapper.cpp:1.4 llvm/lib/Transforms/Utils/ValueMapper.cpp:1.5
--- llvm/lib/Transforms/Utils/ValueMapper.cpp:1.4	Thu Apr 17 22:49:49 2003
+++ llvm/lib/Transforms/Utils/ValueMapper.cpp	Mon Oct  6 10:23:43 2003
@@ -13,6 +13,11 @@
   Value *&VMSlot = VM[V];
   if (VMSlot) return VMSlot;      // Does it exist in the map yet?
   
+  // Global values do not need to be seeded into the ValueMap if they are using
+  // the identity mapping.
+  if (isa<GlobalValue>(V))
+    return VMSlot = const_cast<Value*>(V);
+
   if (Constant *C = const_cast<Constant*>(dyn_cast<Constant>(V))) {
     if (isa<ConstantIntegral>(C) || isa<ConstantFP>(C) ||
         isa<ConstantPointerNull>(C))


Index: llvm/lib/Transforms/Utils/InlineFunction.cpp
diff -u llvm/lib/Transforms/Utils/InlineFunction.cpp:1.11 llvm/lib/Transforms/Utils/InlineFunction.cpp:1.12
--- llvm/lib/Transforms/Utils/InlineFunction.cpp:1.11	Mon Sep 22 18:30:59 2003
+++ llvm/lib/Transforms/Utils/InlineFunction.cpp	Mon Oct  6 10:23:43 2003
@@ -124,14 +124,6 @@
   // Make a vector to capture the return instructions in the cloned function...
   std::vector<ReturnInst*> Returns;
 
-  // Populate the value map with all of the globals in the program.
-  // FIXME: This should be the default for CloneFunctionInto!
-  Module &M = *Caller->getParent();
-  for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
-    ValueMap[I] = I;
-  for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
-    ValueMap[I] = I;
-
   // Do all of the hard part of cloning the callee into the caller...
   CloneFunctionInto(Caller, CalledFunc, ValueMap, Returns, ".i");
 





More information about the llvm-commits mailing list