diff options
author | Dan Gohman <gohman@apple.com> | 2010-04-09 14:53:59 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-04-09 14:53:59 +0000 |
commit | 6c3ae655b846ae663ea14000adf3b42e9455ce56 (patch) | |
tree | 92d8da705e874fe8781f324ee68b2390ab28c997 | |
parent | 7d597b4428dcc120b15fcd92b33515108d54e35e (diff) |
Minor code simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100859 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index 3fb3de7507..8586054fce 100644 --- a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -1735,16 +1735,12 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) { if (ConstantInt *RHS = dyn_cast<ConstantInt>(Op1)) { - if (RHS->isOne() && Op0->hasOneUse()) { + if (RHS->isOne() && Op0->hasOneUse()) // xor (cmp A, B), true = not (cmp A, B) = !cmp A, B - if (ICmpInst *ICI = dyn_cast<ICmpInst>(Op0)) - return new ICmpInst(ICI->getInversePredicate(), - ICI->getOperand(0), ICI->getOperand(1)); - - if (FCmpInst *FCI = dyn_cast<FCmpInst>(Op0)) - return new FCmpInst(FCI->getInversePredicate(), - FCI->getOperand(0), FCI->getOperand(1)); - } + if (CmpInst *CI = dyn_cast<CmpInst>(Op0)) + return CmpInst::Create(CI->getOpcode(), + CI->getInversePredicate(), + CI->getOperand(0), CI->getOperand(1)); // fold (xor(zext(cmp)), 1) and (xor(sext(cmp)), -1) to ext(!cmp). if (CastInst *Op0C = dyn_cast<CastInst>(Op0)) { |