Treat xor of signbit like an add.

llvm-svn: 35586
This commit is contained in:
Chris Lattner 2007-04-02 05:41:38 +00:00
parent d14447833a
commit a3e0bb4ebb

View File

@ -1427,6 +1427,15 @@ SCEVHandle ScalarEvolutionsImpl::createSCEV(Value *V) {
}
}
break;
case Instruction::Xor:
// If the RHS of the xor is a signbit, then this is just an add.
// Instcombine turns add of signbit into xor as a strength reduction step.
if (ConstantInt *CI = dyn_cast<ConstantInt>(I->getOperand(1))) {
if (CI->getValue().isSignBit())
return SCEVAddExpr::get(getSCEV(I->getOperand(0)),
getSCEV(I->getOperand(1)));
}
break;
case Instruction::Shl:
// Turn shift left of a constant amount into a multiply.