aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Analysis/ValueTracking.cpp12
-rw-r--r--lib/Transforms/InstCombine/InstCombineCompares.cpp10
-rw-r--r--test/Transforms/InstCombine/icmp.ll20
3 files changed, 5 insertions, 37 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp
index 70d51fac3f..7e208692ac 100644
--- a/lib/Analysis/ValueTracking.cpp
+++ b/lib/Analysis/ValueTracking.cpp
@@ -460,18 +460,6 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,
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))) {
diff --git a/lib/Transforms/InstCombine/InstCombineCompares.cpp b/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 79c5d88c63..fe117c9814 100644
--- a/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -1348,16 +1348,6 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI,
}
}
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.
diff --git a/test/Transforms/InstCombine/icmp.ll b/test/Transforms/InstCombine/icmp.ll
index f6a18faeb3..ff11bbff77 100644
--- a/test/Transforms/InstCombine/icmp.ll
+++ b/test/Transforms/InstCombine/icmp.ll
@@ -378,28 +378,18 @@ define i1 @test38(i32 %x, i32 %y, i32 %z) {
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