[PATCH] D36214: [InstCombine] Remove explicit code for folding (xor(zext(cmp)), 1) and (xor(sext(cmp)), -1) to ext(!cmp).

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 13:31:21 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL309882: [InstCombine] Remove explicit code for folding (xor(zext(cmp)), 1) and (xor… (authored by ctopper).

Changed prior to commit:
  https://reviews.llvm.org/D36214?vs=109280&id=109413#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D36214

Files:
  llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp


Index: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
===================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -2439,21 +2439,6 @@
   }
 
   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())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36214.109413.patch
Type: text/x-patch
Size: 1224 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170802/530530e1/attachment.bin>


More information about the llvm-commits mailing list