summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-11-06 16:45:27 +0000
committerSanjay Patel <spatel@rotateright.com>2018-11-06 16:45:27 +0000
commit46bf3922c1e8724aa52dbfb733d599d47db04768 (patch)
treec6c2b43ebeef5618b747594da32f1c645e0c3c30 /llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
parent7c3ee4da42be990609193c536329862a8595f424 (diff)
downloadbcm5719-llvm-46bf3922c1e8724aa52dbfb733d599d47db04768.tar.gz
bcm5719-llvm-46bf3922c1e8724aa52dbfb733d599d47db04768.zip
[InstCombine] propagate fast-math-flags when folding fcmp+fpext, part 2
llvm-svn: 346242
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index e8e78d2e652..62493decb4a 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -5483,9 +5483,12 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {
Fabs.clearSign();
if (!Lossy &&
((Fabs.compare(APFloat::getSmallestNormalized(FPSem)) !=
- APFloat::cmpLessThan) || Fabs.isZero()))
- // TODO: Propagate FMF.
- return new FCmpInst(Pred, X, ConstantFP::get(C->getContext(), F));
+ APFloat::cmpLessThan) || Fabs.isZero())) {
+ Instruction *NewFCmp =
+ new FCmpInst(Pred, X, ConstantFP::get(C->getContext(), F));
+ NewFCmp->copyFastMathFlags(&I);
+ return NewFCmp;
+ }
}
}
OpenPOWER on IntegriCloud