-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Revert "[InstCombine] Folding (icmp eq/ne (and X, -P2), INT_MIN)
"
#111236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert "[InstCombine] Folding (icmp eq/ne (and X, -P2), INT_MIN)
"
#111236
Conversation
Created using spr 1.3.4
@llvm/pr-subscribers-llvm-transforms Author: Vitaly Buka (vitalybuka) ChangesReverts #110880 because of exposed issue is Msan instrumentation #111212. This reverts commit a646436. Full diff: https://github.com/llvm/llvm-project/pull/111236.diff 3 Files Affected:
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 12eec99e7d22bb..6c3fc987d9add2 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -5015,18 +5015,6 @@ Instruction *InstCombinerImpl::foldICmpBinOp(ICmpInst &I,
}
}
- // (icmp eq/ne (X, -P2), INT_MIN)
- // -> (icmp slt/sge X, INT_MIN + P2)
- if (ICmpInst::isEquality(Pred) && BO0 &&
- match(I.getOperand(1), m_SignMask()) &&
- match(BO0, m_And(m_Value(), m_NegatedPower2OrZero()))) {
- // Will Constant fold.
- Value *NewC = Builder.CreateSub(I.getOperand(1), BO0->getOperand(1));
- return new ICmpInst(Pred == ICmpInst::ICMP_EQ ? ICmpInst::ICMP_SLT
- : ICmpInst::ICMP_SGE,
- BO0->getOperand(0), NewC);
- }
-
{
// Similar to above: an unsigned overflow comparison may use offset + mask:
// ((Op1 + C) & C) u< Op1 --> Op1 != 0
diff --git a/llvm/test/Transforms/InstCombine/icmp-signmask.ll b/llvm/test/Transforms/InstCombine/icmp-signmask.ll
index 5424f7d7e8021f..bea8da2074ab0b 100644
--- a/llvm/test/Transforms/InstCombine/icmp-signmask.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-signmask.ll
@@ -3,7 +3,8 @@
define i1 @cmp_x_and_negp2_with_eq(i8 %x) {
; CHECK-LABEL: @cmp_x_and_negp2_with_eq(
-; CHECK-NEXT: [[R:%.*]] = icmp slt i8 [[X:%.*]], -126
+; CHECK-NEXT: [[ANDX:%.*]] = and i8 [[X:%.*]], -2
+; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[ANDX]], -128
; CHECK-NEXT: ret i1 [[R]]
;
%andx = and i8 %x, -2
@@ -24,7 +25,8 @@ define i1 @cmp_x_and_negp2_with_eq_fail_not_signmask(i8 %x) {
define <2 x i1> @cmp_x_and_negp2_with_ne(<2 x i8> %x) {
; CHECK-LABEL: @cmp_x_and_negp2_with_ne(
-; CHECK-NEXT: [[R:%.*]] = icmp sgt <2 x i8> [[X:%.*]], <i8 -121, i8 -113>
+; CHECK-NEXT: [[ANDX:%.*]] = and <2 x i8> [[X:%.*]], <i8 -8, i8 -16>
+; CHECK-NEXT: [[R:%.*]] = icmp ne <2 x i8> [[ANDX]], <i8 -128, i8 -128>
; CHECK-NEXT: ret <2 x i1> [[R]]
;
%andx = and <2 x i8> %x, <i8 -8, i8 -16>
@@ -34,7 +36,8 @@ define <2 x i1> @cmp_x_and_negp2_with_ne(<2 x i8> %x) {
define <2 x i1> @cmp_x_and_negp2_with_ne_or_z(<2 x i8> %x) {
; CHECK-LABEL: @cmp_x_and_negp2_with_ne_or_z(
-; CHECK-NEXT: [[R:%.*]] = icmp sge <2 x i8> [[X:%.*]], <i8 -128, i8 -112>
+; CHECK-NEXT: [[ANDX:%.*]] = and <2 x i8> [[X:%.*]], <i8 0, i8 -16>
+; CHECK-NEXT: [[R:%.*]] = icmp ne <2 x i8> [[ANDX]], <i8 -128, i8 -128>
; CHECK-NEXT: ret <2 x i1> [[R]]
;
%andx = and <2 x i8> %x, <i8 0, i8 -16>
diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll
index 17ed64b6e04d91..ecf21b8a42cf50 100644
--- a/llvm/test/Transforms/InstCombine/icmp.ll
+++ b/llvm/test/Transforms/InstCombine/icmp.ll
@@ -1116,7 +1116,8 @@ define i1 @test53(i32 %a, i32 %b) {
define i1 @test54(i8 %a) {
; CHECK-LABEL: @test54(
-; CHECK-NEXT: [[RET:%.*]] = icmp slt i8 [[A:%.*]], -64
+; CHECK-NEXT: [[TMP1:%.*]] = and i8 [[A:%.*]], -64
+; CHECK-NEXT: [[RET:%.*]] = icmp eq i8 [[TMP1]], -128
; CHECK-NEXT: ret i1 [[RET]]
;
%ext = zext i8 %a to i32
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/160/builds/6311 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/144/builds/8732 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/180/builds/6309 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/3/builds/5737 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/65/builds/5717 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/185/builds/6415 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/137/builds/6502 Here is the relevant piece of the build log for the reference
|
…lvm#111236) Reverts llvm#110880 because of exposed issue is Msan instrumentation llvm#111212. This reverts commit a646436.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/175/builds/6434 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/133/builds/4770 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/154/builds/5523 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/7127 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/46/builds/6011 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/155/builds/2999 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/108/builds/4512 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/168/builds/4111 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/11019 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/187/builds/1669 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/54/builds/2874 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/161/builds/2545 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/33/builds/4298 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/125/builds/2583 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/39/builds/2070 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/23/builds/3580 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/110/builds/1606 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/40/builds/2153 Here is the relevant piece of the build log for the reference
|
* commit 'FETCH_HEAD': [clang][bytecode] Handle UETT_OpenMPRequiredSimdAlign (llvm#111259) [mlir][polynomial] Add and verify constraints of coefficientModulus for ringAttr (llvm#111016) [clang][bytecode] Save a per-Block IsWeak bit (llvm#111248) [analyzer] Fix wrong `builtin_*_overflow` return type (llvm#111253) [SelectOpt] Don't convert constant selects to branches. (llvm#110858) [InstCombine] Update and-or-icmps.ll after 574266c. NFC [Instcombine] Test for more gep canonicalization [NFC][TableGen] Change `CodeGenIntrinsics` to use const references (llvm#111219) Add warning message to `session save` when transcript isn't saved. (llvm#109020) [RISCV][TTI] Recognize CONCAT_VECTORS if a shufflevector mask is multiple insert subvector. (llvm#110457) Revert "[InstCombine] Folding `(icmp eq/ne (and X, -P2), INT_MIN)`" (llvm#111236) [NFC][lsan] Add SuspendAllThreads traces [lsan] Add `thread_suspend_fail` flag Signed-off-by: kyvangka1610 <[email protected]>
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/16/builds/6659 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/60/builds/9487 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/56/builds/9194 Here is the relevant piece of the build log for the reference
|
…lvm#111236) The underlying issue with msan was fixed by llvm#113200
Reverts #110880 because of exposed issue is Msan instrumentation #111212.
This reverts commit a646436.