[llvm-commits] CVS: llvm/lib/Transforms/IPO/IPConstantPropagation.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Nov 10 11:44:11 PST 2004



Changes in directory llvm/lib/Transforms/IPO:

IPConstantPropagation.cpp updated: 1.10 -> 1.11
---
Log message:

Make IP Constant prop more aggressive about handling self recursive calls.
This implements IPConstantProp/recursion.ll


---
Diffs of the changes:  (+4 -2)

Index: llvm/lib/Transforms/IPO/IPConstantPropagation.cpp
diff -u llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.10 llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.11
--- llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.10	Tue Nov  9 14:47:30 2004
+++ llvm/lib/Transforms/IPO/IPConstantPropagation.cpp	Wed Nov 10 13:43:59 2004
@@ -81,7 +81,9 @@
       
       // Check out all of the potentially constant arguments
       CallSite::arg_iterator AI = CS.arg_begin();
-      for (unsigned i = 0, e = ArgumentConstants.size(); i != e; ++i, ++AI) {
+      Function::aiterator Arg = F.abegin();
+      for (unsigned i = 0, e = ArgumentConstants.size(); i != e;
+           ++i, ++AI, ++Arg) {
         if (*AI == &F) return false;  // Passes the function into itself
 
         if (!ArgumentConstants[i].second) {
@@ -94,7 +96,7 @@
               ++NumNonconstant;
               if (NumNonconstant == ArgumentConstants.size()) return false;
             }
-          } else {
+          } else if (*AI != &*Arg) {    // Ignore recursive calls with same arg
             // This is not a constant argument.  Mark the argument as
             // non-constant.
             ArgumentConstants[i].second = true;






More information about the llvm-commits mailing list