mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
Fold ashr -1, X into -1
llvm-svn: 4070
This commit is contained in:
parent
1e39dc6f80
commit
55c7ae3cdc
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user