From: Chris Lattner Date: Tue, 10 May 2005 03:39:25 +0000 (+0000) Subject: Fix Reassociate/shifttest.ll X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=641f02f10f08c9a9add651c6f0169f5441eaeb49;p=oota-llvm.git Fix Reassociate/shifttest.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21839 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp index af0c6118a27..0990bc59455 100644 --- a/lib/Transforms/Scalar/Reassociate.cpp +++ b/lib/Transforms/Scalar/Reassociate.cpp @@ -556,6 +556,13 @@ static void PrintOps(unsigned Opcode, const std::vector &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(BI->getOperand(1))) + if (Instruction *NI = ConvertShiftToMul(BI)) { + MadeChange = true; + BI = NI; + } + // Reject cases where it is pointless to do this. if (!isa(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(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;