From 021507be8244aadf7767b1b8a9c26d4c47817a74 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 5 Aug 2008 21:23:45 +0000 Subject: [PATCH] Revert r53282. This was causing a miscompile on Linux. Also, the transformation looks bogus. Please see PR2629 for details on why this is breaking things. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54372 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/InstructionCombining.cpp | 16 ---------------- .../Transforms/InstCombine/2008-07-08-AndICmp.ll | 10 ---------- 2 files changed, 26 deletions(-) delete mode 100644 test/Transforms/InstCombine/2008-07-08-AndICmp.ll diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index c5f4dea0f0f..d15b6cf18bd 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -3586,22 +3586,6 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) { } } - - { // (icmp ugt/ult A, C) & (icmp B, C) --> (icmp (A|B), C) - // where C is a power of 2 - Value *A, *B; - ConstantInt *C1, *C2; - ICmpInst::Predicate LHSCC, RHSCC; - if (match(&I, m_And(m_ICmp(LHSCC, m_Value(A), m_ConstantInt(C1)), - m_ICmp(RHSCC, m_Value(B), m_ConstantInt(C2))))) - if (C1 == C2 && LHSCC == RHSCC && C1->getValue().isPowerOf2() && - (LHSCC == ICmpInst::ICMP_ULT || LHSCC == ICmpInst::ICMP_UGT)) { - Instruction *NewOr = BinaryOperator::CreateOr(A, B); - InsertNewInstBefore(NewOr, I); - return new ICmpInst(LHSCC, NewOr, C1); - } - } - if (ICmpInst *RHS = dyn_cast(Op1)) { // (icmp1 A, B) & (icmp2 A, B) --> (icmp3 A, B) if (Instruction *R = AssociativeOpt(I, FoldICmpLogical(*this, RHS))) diff --git a/test/Transforms/InstCombine/2008-07-08-AndICmp.ll b/test/Transforms/InstCombine/2008-07-08-AndICmp.ll deleted file mode 100644 index c6002413147..00000000000 --- a/test/Transforms/InstCombine/2008-07-08-AndICmp.ll +++ /dev/null @@ -1,10 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep icmp | count 1 -; PR2330 - -define i1 @foo(i32 %a, i32 %b) nounwind { -entry: - icmp ult i32 %a, 8 ; :0 [#uses=1] - icmp ult i32 %b, 8 ; :1 [#uses=1] - and i1 %1, %0 ; :2 [#uses=1] - ret i1 %2 -} -- 2.34.1