]> granicus.if.org Git - llvm/commitdiff
[InstCombine] Remove explicit code for folding (xor(zext(cmp)), 1) and (xor(sext...
authorCraig Topper <craig.topper@intel.com>
Wed, 2 Aug 2017 20:30:27 +0000 (20:30 +0000)
committerCraig Topper <craig.topper@intel.com>
Wed, 2 Aug 2017 20:30:27 +0000 (20:30 +0000)
As far as I can tell this should be handled by foldCastedBitwiseLogic which is called later in visitXor.

Differential Revision: https://reviews.llvm.org/D36214

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

lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

index 87678f3777c117bb97a55fe3593a0ec2ae94811a..62a73cca4b7a706e4bd6f8f91a3fa652ff27d3b5 100644 (file)
@@ -2439,21 +2439,6 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) {
   }
 
   if (ConstantInt *RHSC = dyn_cast<ConstantInt>(Op1)) {
-    // fold (xor(zext(cmp)), 1) and (xor(sext(cmp)), -1) to ext(!cmp).
-    if (CastInst *Op0C = dyn_cast<CastInst>(Op0)) {
-      if (CmpInst *CI = dyn_cast<CmpInst>(Op0C->getOperand(0))) {
-        if (CI->hasOneUse() && Op0C->hasOneUse()) {
-          Instruction::CastOps Opcode = Op0C->getOpcode();
-          if ((Opcode == Instruction::ZExt || Opcode == Instruction::SExt) &&
-              (RHSC == ConstantExpr::getCast(Opcode, Builder.getTrue(),
-                                             Op0C->getDestTy()))) {
-            CI->setPredicate(CI->getInversePredicate());
-            return CastInst::Create(Opcode, CI, Op0C->getType());
-          }
-        }
-      }
-    }
-
     if (BinaryOperator *Op0I = dyn_cast<BinaryOperator>(Op0)) {
       // ~(c-X) == X-c-1 == X+(-c-1)
       if (Op0I->getOpcode() == Instruction::Sub && RHSC->isMinusOne())