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 | 31c667e2341fc20a9a4dd9c5cab49cb046ca07bc (patch) | |
| tree | c334991cd5d3bd26294213174727a65420db9269 | |
| parent | 915594d8841c2e0ac2b9f09bcf20ec5ea2c8b3d4 (diff) | |
| download | bcm5719-llvm-31c667e2341fc20a9a4dd9c5cab49cb046ca07bc.tar.gz bcm5719-llvm-31c667e2341fc20a9a4dd9c5cab49cb046ca07bc.zip | |
Fix Reassociate/shifttest.ll
llvm-svn: 21839
| -rw-r--r-- | llvm/lib/Transforms/Scalar/Reassociate.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index af0c6118a27..0990bc59455 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/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; |

