[llvm-commits] [llvm] r126644 - in /llvm/trunk: lib/Analysis/ValueTracking.cpp lib/Transforms/InstCombine/InstCombineCompares.cpp test/Transforms/InstCombine/icmp.ll
Nick Lewycky
nicholas at mxc.ca
Mon Feb 28 01:17:39 PST 2011
Author: nicholas
Date: Mon Feb 28 03:17:39 2011
New Revision: 126644
URL: http://llvm.org/viewvc/llvm-project?rev=126644&view=rev
Log:
srem doesn't actually have the same resulting sign as its numerator, you could
also have a zero when numerator = denominator. Reverts parts of r126635 and
r126637.
Modified:
llvm/trunk/lib/Analysis/ValueTracking.cpp
llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/trunk/test/Transforms/InstCombine/icmp.ll
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=126644&r1=126643&r2=126644&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Mon Feb 28 03:17:39 2011
@@ -460,18 +460,6 @@
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))) {
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=126644&r1=126643&r2=126644&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Mon Feb 28 03:17:39 2011
@@ -1348,16 +1348,6 @@
}
}
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.
Modified: llvm/trunk/test/Transforms/InstCombine/icmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/icmp.ll?rev=126644&r1=126643&r2=126644&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/icmp.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/icmp.ll Mon Feb 28 03:17:39 2011
@@ -378,28 +378,18 @@
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
More information about the llvm-commits
mailing list