[PATCH] D36214: [InstCombine] Remove explicit code for folding (xor(zext(cmp)), 1) and (xor(sext(cmp)), -1) to ext(!cmp).
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 1 23:58:51 PDT 2017
craig.topper created this revision.
As far as I can tell this should be handled by foldCastedBitwiseLogic which is called later in visitXor.
https://reviews.llvm.org/D36214
Files:
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
Index: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
===================================================================
--- lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -2429,21 +2429,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.109280.patch
Type: text/x-patch
Size: 1191 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170802/cf0910e3/attachment.bin>
More information about the llvm-commits
mailing list