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

Chris Lattner lattner at cs.uiuc.edu
Mon Aug 1 19:52:13 PDT 2005



Changes in directory llvm/lib/Transforms/Scalar:

LoopStrengthReduce.cpp updated: 1.20 -> 1.21
---
Log message:

add a comment, make a check more lenient


---
Diffs of the changes:  (+10 -8)

 LoopStrengthReduce.cpp |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.20 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.21
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.20	Mon Aug  1 21:44:31 2005
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp	Mon Aug  1 21:52:02 2005
@@ -71,6 +71,9 @@
     const TargetData *TD;
     const Type *UIntPtrTy;
     bool Changed;
+
+    /// MaxTargetAMSize - This is the maximum power-of-two scale value that the
+    /// target can handle for free with its addressing modes.
     unsigned MaxTargetAMSize;
 
     /// IVUsesByStride - Keep track of all uses of induction variables that we
@@ -649,15 +652,14 @@
       // compared against some value to decide loop termination.
       if (PN->hasOneUse()) {
         BinaryOperator *BO = dyn_cast<BinaryOperator>(*(PN->use_begin()));
-        if (BO && BO->getOpcode() == Instruction::Add)
-          if (BO->hasOneUse()) {
-            if (PN == dyn_cast<PHINode>(*(BO->use_begin()))) {
-              DeadInsts.insert(BO);
-              // Break the cycle, then delete the PHI.
-              PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
-              PN->eraseFromParent();
-            }
+        if (BO && BO->hasOneUse()) {
+          if (PN == *(BO->use_begin())) {
+            DeadInsts.insert(BO);
+            // Break the cycle, then delete the PHI.
+            PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
+            PN->eraseFromParent();
           }
+        }
       }
     }
     DeleteTriviallyDeadInstructions(DeadInsts);






More information about the llvm-commits mailing list