]> granicus.if.org Git - llvm/commitdiff
[InstCombine] Remove some code from visitAnd that dealt with trying to reduce the...
authorCraig Topper <craig.topper@gmail.com>
Thu, 23 Mar 2017 21:00:13 +0000 (21:00 +0000)
committerCraig Topper <craig.topper@gmail.com>
Thu, 23 Mar 2017 21:00:13 +0000 (21:00 +0000)
Now that we call ShrinkDemandedConstant on the RHS of sub this should be taken care of. This code doesn't trigger on any in tree regressions, but did before ShrinkDemandedConstant was added to the RHS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298644 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

index b06bb1bb877374f67d3a3f54933f8ae9a0c213aa..13f3f31fdf91dc3abee5c810174117529ffd7308 100644 (file)
@@ -1335,18 +1335,6 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
         if (AndRHSMask == 1 && match(Op0LHS, m_Zero()))
           return BinaryOperator::CreateAnd(Op0RHS, AndRHS);
 
-        // (A - N) & AndRHS -> -N & AndRHS iff A&AndRHS==0 and AndRHS
-        // has 1's for all bits that the subtraction with A might affect.
-        if (Op0I->hasOneUse() && !match(Op0LHS, m_Zero())) {
-          uint32_t BitWidth = AndRHSMask.getBitWidth();
-          uint32_t Zeros = AndRHSMask.countLeadingZeros();
-          APInt Mask = APInt::getLowBitsSet(BitWidth, BitWidth - Zeros);
-
-          if (MaskedValueIsZero(Op0LHS, Mask, 0, &I)) {
-            Value *NewNeg = Builder->CreateNeg(Op0RHS);
-            return BinaryOperator::CreateAnd(NewNeg, AndRHS);
-          }
-        }
         break;
 
       case Instruction::Shl: