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

Chris Lattner lattner at cs.uiuc.edu
Mon May 9 20:39:42 PDT 2005



Changes in directory llvm/lib/Transforms/Scalar:

Reassociate.cpp updated: 1.48 -> 1.49
---
Log message:

Fix Reassociate/shifttest.ll


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

 Reassociate.cpp |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)


Index: llvm/lib/Transforms/Scalar/Reassociate.cpp
diff -u llvm/lib/Transforms/Scalar/Reassociate.cpp:1.48 llvm/lib/Transforms/Scalar/Reassociate.cpp:1.49
--- llvm/lib/Transforms/Scalar/Reassociate.cpp:1.48	Sun May  8 16:41:35 2005
+++ llvm/lib/Transforms/Scalar/Reassociate.cpp	Mon May  9 22:39:25 2005
@@ -556,6 +556,13 @@
 /// reassociating them as we go.
 void Reassociate::ReassociateBB(BasicBlock *BB) {
   for (BasicBlock::iterator BI = BB->begin(); BI != BB->end(); ++BI) {
+    if (BI->getOpcode() == Instruction::Shl &&
+        isa<ConstantInt>(BI->getOperand(1)))
+      if (Instruction *NI = ConvertShiftToMul(BI)) {
+        MadeChange = true;
+        BI = NI;
+      }
+
     // Reject cases where it is pointless to do this.
     if (!isa<BinaryOperator>(BI) || BI->getType()->isFloatingPoint())
       continue;  // Floating point ops are not associative.
@@ -579,12 +586,6 @@
         }
       }
     }
-    if (BI->getOpcode() == Instruction::Shl &&
-        isa<ConstantInt>(BI->getOperand(1)))
-      if (Instruction *NI = ConvertShiftToMul(BI)) {
-        MadeChange = true;
-        BI = NI;
-      }
 
     // If this instruction is a commutative binary operator, process it.
     if (!BI->isAssociative()) continue;






More information about the llvm-commits mailing list