mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-16 14:31:59 +00:00
Fix a minor bug where we would go into infinite loops on some constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14638 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5b73c08896
commit
1e3564ef05
@ -846,7 +846,8 @@ Instruction *InstCombiner::visitDiv(BinaryOperator &I) {
|
||||
Instruction *InstCombiner::visitRem(BinaryOperator &I) {
|
||||
if (I.getType()->isSigned())
|
||||
if (Value *RHSNeg = dyn_castNegVal(I.getOperand(1)))
|
||||
if (RHSNeg != I.getOperand(1)) { // Avoid problems with MININT
|
||||
if (!isa<ConstantSInt>(RHSNeg) ||
|
||||
cast<ConstantSInt>(RHSNeg)->getValue() >= 0) {
|
||||
// X % -Y -> X % Y
|
||||
AddUsesToWorkList(I);
|
||||
I.setOperand(1, RHSNeg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user