diff options
| author | Nick Lewycky <nicholas@mxc.ca> | 2007-08-06 20:04:16 +0000 |
|---|---|---|
| committer | Nick Lewycky <nicholas@mxc.ca> | 2007-08-06 20:04:16 +0000 |
| commit | 8052019a20c5fd87b00a0bc39096d7cc07453081 (patch) | |
| tree | 281685059602c4cd9a2ef43f8efdc2fe6e7be266 /llvm/lib | |
| parent | f921f1bc4af00f1bb7041f885caece480625cfc0 (diff) | |
| download | bcm5719-llvm-8052019a20c5fd87b00a0bc39096d7cc07453081.tar.gz bcm5719-llvm-8052019a20c5fd87b00a0bc39096d7cc07453081.zip | |
It's safe to fold not of fcmp.
llvm-svn: 40870
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 15dec4fbcf9..d8df139efa3 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -4134,12 +4134,17 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) { if (ConstantInt *RHS = dyn_cast<ConstantInt>(Op1)) { - // xor (icmp A, B), true = not (icmp A, B) = !icmp A, B - if (ICmpInst *ICI = dyn_cast<ICmpInst>(Op0)) - if (RHS == ConstantInt::getTrue() && ICI->hasOneUse()) + // xor (cmp A, B), true = not (cmp A, B) = !cmp A, B + if (RHS == ConstantInt::getTrue() && Op0->hasOneUse()) { + 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 (BinaryOperator *Op0I = dyn_cast<BinaryOperator>(Op0)) { // ~(c-X) == X-c-1 == X+(-c-1) if (Op0I->getOpcode() == Instruction::Sub && RHS->isAllOnesValue()) |

