summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-11-06 15:58:57 +0000
committerSanjay Patel <spatel@rotateright.com>2018-11-06 15:58:57 +0000
commit2fd5b0ebfba459c6cfb24f111d2cdd4959269d12 (patch)
treefdd4308a06a94230946c543f1def21106341077b /llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
parentb3fbba6d15d35b0890578a7fa0783c23de6e8b9e (diff)
downloadbcm5719-llvm-2fd5b0ebfba459c6cfb24f111d2cdd4959269d12.tar.gz
bcm5719-llvm-2fd5b0ebfba459c6cfb24f111d2cdd4959269d12.zip
[InstCombine] propagate fast-math-flags when folding fcmp+fneg, part 2
llvm-svn: 346238
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 975cb83b8f3..c1c904b331a 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -5467,9 +5467,10 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {
Value *X, *Y;
if (match(Op0, m_FNeg(m_Value(X)))) {
if (match(Op1, m_FNeg(m_Value(Y)))) {
- // FIXME: Drops FMF.
// fcmp pred (fneg X), (fneg Y) -> fcmp swap(pred) X, Y
- return new FCmpInst(I.getSwappedPredicate(), X, Y);
+ Instruction *NewFCmp = new FCmpInst(I.getSwappedPredicate(), X, Y);
+ NewFCmp->copyFastMathFlags(&I);
+ return NewFCmp;
}
Constant *C;
OpenPOWER on IntegriCloud