assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");
}
}
- if (Mask.isNegative()) { // We're looking for the sign bit.
- APInt Mask2 = APInt::getSignBit(BitWidth);
- KnownZero2 = 0;
- KnownOne2 = 0;
- ComputeMaskedBits(I->getOperand(0), Mask2, KnownZero2, KnownOne2, TD,
- Depth+1);
- if (KnownOne2[BitWidth-1])
- KnownOne |= Mask2;
- if (KnownZero2[BitWidth-1])
- KnownZero |= Mask2;
- assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");
- }
break;
case Instruction::URem: {
if (ConstantInt *Rem = dyn_cast<ConstantInt>(I->getOperand(1))) {
}
}
break;
-
- case Instruction::SRem: {
- bool TrueIfSigned;
- if (LHSI->hasOneUse() &&
- isSignBitCheck(ICI.getPredicate(), RHS, TrueIfSigned)) {
- // srem has the same sign as its dividend so the divisor is irrelevant.
- return new ICmpInst(ICI.getPredicate(), LHSI->getOperand(0), RHS);
- }
- break;
- }
}
// Simplify icmp_eq and icmp_ne instructions with integer constant RHS.
ret i1 %c
}
-; PR9343 #7
-; CHECK: @test39
-; CHECK: ret i1 false
-define i1 @test39(i31 %X, i32 %Y) {
- %A = zext i31 %X to i32
- %B = srem i32 %A, %Y
- %C = icmp slt i32 %B, 0
- ret i1 %C
-}
-
; PR9343 #1
-; CHECK: test40
+; CHECK: test39
; CHECK %B = icmp eq i32 %X, 0
-define i1 @test40(i32 %X, i32 %Y) {
+define i1 @test39(i32 %X, i32 %Y) {
%A = ashr exact i32 %X, %Y
%B = icmp eq i32 %A, 0
ret i1 %B
}
-; CHECK: test41
-; CHECK %B = icmp ne i32 %X, 0
-define i1 @test41(i32 %X, i32 %Y) {
+; CHECK: test40
+; CHECK: %B = icmp ne i32 %X, 0
+define i1 @test40(i32 %X, i32 %Y) {
%A = lshr exact i32 %X, %Y
%B = icmp ne i32 %A, 0
ret i1 %B