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

Chris Lattner lattner at cs.uiuc.edu
Tue Aug 12 16:46:02 PDT 2003


Changes in directory llvm/lib/Transforms/Scalar:

Reassociate.cpp updated: 1.20 -> 1.21

---
Log message:

Fix bug: Reassociate/2003-08-12-InfiniteLoop.ll



---
Diffs of the changes:

Index: llvm/lib/Transforms/Scalar/Reassociate.cpp
diff -u llvm/lib/Transforms/Scalar/Reassociate.cpp:1.20 llvm/lib/Transforms/Scalar/Reassociate.cpp:1.21
--- llvm/lib/Transforms/Scalar/Reassociate.cpp:1.20	Tue Aug 12 15:14:27 2003
+++ llvm/lib/Transforms/Scalar/Reassociate.cpp	Tue Aug 12 16:45:24 2003
@@ -126,12 +126,13 @@
     if (LHSI->getOpcode() == I->getOpcode() && LHSI->use_size() == 1) {
       // If the rank of our current RHS is less than the rank of the LHS's LHS,
       // then we reassociate the two instructions...
-      if (RHSRank < getRank(LHSI->getOperand(0))) {
-        unsigned TakeOp = 0;
-        if (BinaryOperator *IOp = dyn_cast<BinaryOperator>(LHSI->getOperand(0)))
-          if (IOp->getOpcode() == LHSI->getOpcode())
-            TakeOp = 1;   // Hoist out non-tree portion
 
+      unsigned TakeOp = 0;
+      if (BinaryOperator *IOp = dyn_cast<BinaryOperator>(LHSI->getOperand(0)))
+        if (IOp->getOpcode() == LHSI->getOpcode())
+          TakeOp = 1;   // Hoist out non-tree portion
+
+      if (RHSRank < getRank(LHSI->getOperand(TakeOp))) {
         // Convert ((a + 12) + 10) into (a + (12 + 10))
         I->setOperand(0, LHSI->getOperand(TakeOp));
         LHSI->setOperand(TakeOp, RHS);





More information about the llvm-commits mailing list