mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-10 20:33:15 +00:00
PR3439: Correct a silly mistake in the SimplifyDemandedUseBits code for
SRem. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73598 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
63dc318085
commit
a999a511f7
@ -1336,7 +1336,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
|
||||
if (ConstantInt *Rem = dyn_cast<ConstantInt>(I->getOperand(1))) {
|
||||
APInt RA = Rem->getValue().abs();
|
||||
if (RA.isPowerOf2()) {
|
||||
if (DemandedMask.ule(RA)) // srem won't affect demanded bits
|
||||
if (DemandedMask.ult(RA)) // srem won't affect demanded bits
|
||||
return I->getOperand(0);
|
||||
|
||||
APInt LowBits = RA - 1;
|
||||
|
18
test/Transforms/InstCombine/2009-06-16-SRemDemandedBits.ll
Normal file
18
test/Transforms/InstCombine/2009-06-16-SRemDemandedBits.ll
Normal file
@ -0,0 +1,18 @@
|
||||
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep srem
|
||||
; PR3439
|
||||
|
||||
define i32 @a(i32 %x) nounwind {
|
||||
entry:
|
||||
%rem = srem i32 %x, 2
|
||||
%and = and i32 %rem, 2
|
||||
ret i32 %and
|
||||
}
|
||||
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep srem
|
||||
; PR3439
|
||||
|
||||
define i32 @a(i32 %x) nounwind {
|
||||
entry:
|
||||
%rem = srem i32 %x, 2
|
||||
%and = and i32 %rem, 2
|
||||
ret i32 %and
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user