1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

Fold ashr -1, X into -1

llvm-svn: 4070
This commit is contained in:
Chris Lattner 2002-10-08 16:16:40 +00:00
parent 1e39dc6f80
commit 55c7ae3cdc

View File

@ -503,6 +503,12 @@ Instruction *InstCombiner::visitShiftInst(Instruction &I) {
return BinaryOperator::create(Instruction::Add, Op0, Op0, I.getName());
}
// shr int -1, X = -1 (for any arithmetic shift rights of ~0)
if (ConstantSInt *CSI = dyn_cast<ConstantSInt>(Op0))
if (I.getOpcode() == Instruction::Shr && CSI->isAllOnesValue())
return ReplaceInstUsesWith(I, CSI);
return 0;
}