/// 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.
}
}
}
- 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;