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

Chris Lattner lattner at cs.uiuc.edu
Sun Mar 6 14:52:45 PST 2005



Changes in directory llvm/lib/Transforms/Scalar:

LoopStrengthReduce.cpp updated: 1.11 -> 1.12
---
Log message:

fix a bug where we thought arguments were constants :(


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

 LoopStrengthReduce.cpp |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.11 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.12
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.11	Sun Mar  6 16:36:12 2005
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp	Sun Mar  6 16:52:29 2005
@@ -154,15 +154,19 @@
       inc_op_vector.push_back(ConstantInt::get(Ty, 1));
       indvar = op;
       break;
-    } else if (isa<Constant>(operand) || isa<Argument>(operand)) {
+    } else if (isa<Argument>(operand)) {
+      pre_op_vector.push_back(operand);
+      AllConstantOperands = false;
+    } else if (isa<Constant>(operand)) {
       pre_op_vector.push_back(operand);
     } else if (Instruction *inst = dyn_cast<Instruction>(operand)) {
       if (!DS->dominates(inst, Preheader->getTerminator()))
         return;
       pre_op_vector.push_back(operand);
       AllConstantOperands = false;
-    } else
-      return;
+    } else {
+      return;  // Cannot handle this.
+    }
     Cache = Cache->get(operand);
   }
   assert(indvar > 0 && "Indvar used by GEP not found in operand list");






More information about the llvm-commits mailing list