[llvm] r309882 - [InstCombine] Remove explicit code for folding (xor(zext(cmp)), 1) and (xor(sext(cmp)), -1) to ext(!cmp).
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 2 13:30:27 PDT 2017
Author: ctopper
Date: Wed Aug 2 13:30:27 2017
New Revision: 309882
URL: http://llvm.org/viewvc/llvm-project?rev=309882&view=rev
Log:
[InstCombine] Remove explicit code for folding (xor(zext(cmp)), 1) and (xor(sext(cmp)), -1) to ext(!cmp).
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
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=309882&r1=309881&r2=309882&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Wed Aug 2 13:30:27 2017
@@ -2439,21 +2439,6 @@ Instruction *InstCombiner::visitXor(Bina
}
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())
More information about the llvm-commits
mailing list