summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-05-10 03:39:25 +0000
committerChris Lattner <sabre@nondot.org>2005-05-10 03:39:25 +0000
commit31c667e2341fc20a9a4dd9c5cab49cb046ca07bc (patch)
treec334991cd5d3bd26294213174727a65420db9269 /llvm/lib/Transforms
parent915594d8841c2e0ac2b9f09bcf20ec5ea2c8b3d4 (diff)
downloadbcm5719-llvm-31c667e2341fc20a9a4dd9c5cab49cb046ca07bc.tar.gz
bcm5719-llvm-31c667e2341fc20a9a4dd9c5cab49cb046ca07bc.zip
Fix Reassociate/shifttest.ll
llvm-svn: 21839
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/Reassociate.cpp13
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;
OpenPOWER on IntegriCloud