Fix Reassociate/shifttest.ll
authorChris Lattner <sabre@nondot.org>
Tue, 10 May 2005 03:39:25 +0000 (03:39 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 10 May 2005 03:39:25 +0000 (03:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21839 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/Reassociate.cpp

index af0c6118a2774caf74ac5cfbbee35bb044ac1e05..0990bc59455e8247973c2332e4e9a6884a5a4ce5 100644 (file)
@@ -556,6 +556,13 @@ static void PrintOps(unsigned Opcode, const std::vector<ValueEntry> &Ops,
 /// 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 @@ void Reassociate::ReassociateBB(BasicBlock *BB) {
         }
       }
     }
-    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;