Fix Reassociate/shifttest.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21839 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-05-10 03:39:25 +00:00
parent 19bb2283e6
commit 641f02f10f

View File

@ -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;