diff options
author | Chris Lattner <sabre@nondot.org> | 2005-05-10 03:39:25 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-05-10 03:39:25 +0000 |
commit | 641f02f10f08c9a9add651c6f0169f5441eaeb49 (patch) | |
tree | da1ff243d7c807a6c2f1b44fa1780eda1a6627e3 /lib/Transforms/Scalar/Reassociate.cpp | |
parent | 19bb2283e6b3ce2bcb8bbbe76c61682caae3ddc7 (diff) |
Fix Reassociate/shifttest.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21839 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/Reassociate.cpp')
-rw-r--r-- | lib/Transforms/Scalar/Reassociate.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp index af0c6118a2..0990bc5945 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<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; |