[llvm-commits] CVS: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Jul 25 19:47:22 PDT 2004



Changes in directory llvm/lib/Transforms/Scalar:

IndVarSimplify.cpp updated: 1.67 -> 1.68

---
Log message:

Throttle back indvar substitution from creating multiplies in loops.  This is bad bad bad.


---
Diffs of the changes:  (+3 -3)

Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.67 llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.68
--- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.67	Thu Jun 24 01:49:18 2004
+++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp	Sun Jul 25 21:47:12 2004
@@ -607,9 +607,9 @@
         // variable.  Doing so will put expensive multiply instructions inside
         // of the loop.  For now just disable indvar subst on anything more
         // complex than a linear addrec.
-        if (!isa<SCEVAddRecExpr>(SCEV) || 
-            cast<SCEVAddRecExpr>(SCEV)->getNumOperands() < 3)
-          IndVars.push_back(std::make_pair(PN, SCEV));
+        if (SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(SCEV))
+          if (AR->getNumOperands() == 2 && isa<SCEVConstant>(AR->getOperand(1)))
+            IndVars.push_back(std::make_pair(PN, SCEV));
     }
 
   // If there are no induction variables in the loop, there is nothing more to





More information about the llvm-commits mailing list