mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-22 10:33:23 +00:00
Fold ashr -1, X into -1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4070 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
af1b4ad24c
commit
6eaeb5764c
@ -503,6 +503,12 @@ Instruction *InstCombiner::visitShiftInst(Instruction &I) {
|
|||||||
return BinaryOperator::create(Instruction::Add, Op0, Op0, I.getName());
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user