diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-03-31 10:12:15 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-03-31 10:12:15 +0000 |
commit | 0db50189dcde3408134e9011052ed8b731ec303a (patch) | |
tree | 3b0ab5bfc16905ec88b7b548951e7578c3ca40d0 /lib/Transforms/InstCombine/InstCombineCompares.cpp | |
parent | b194bdc03b6aa932ba4f719a8aa02db8d498f364 (diff) | |
download | external_llvm-0db50189dcde3408134e9011052ed8b731ec303a.tar.gz external_llvm-0db50189dcde3408134e9011052ed8b731ec303a.tar.bz2 external_llvm-0db50189dcde3408134e9011052ed8b731ec303a.zip |
InstCombine: fold fcmp pred (fneg x), C -> fcmp swap(pred) x, -C
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128626 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineCompares.cpp')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineCompares.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCompares.cpp b/lib/Transforms/InstCombine/InstCombineCompares.cpp index 48ce7cffb5..6743885cd4 100644 --- a/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -2834,6 +2834,14 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) { return SelectInst::Create(LHSI->getOperand(0), Op1, Op2); break; } + case Instruction::FSub: { + // fcmp pred (fneg x), C -> fcmp swap(pred) x, -C + Value *Op; + if (match(LHSI, m_FNeg(m_Value(Op)))) + return new FCmpInst(I.getSwappedPredicate(), Op, + ConstantExpr::getFNeg(RHSC)); + break; + } case Instruction::Load: if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(LHSI->getOperand(0))) { |