summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2015-12-31 23:40:59 +0000
committerSanjay Patel <spatel@rotateright.com>2015-12-31 23:40:59 +0000
commitbee05caa6b26cd945efce349dd53285ecae526fa (patch)
treeb21b0d5a49ae9a66a6d23ce5ecfc8df642385aea /llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
parent74658dfaadcfe47e76ad03f7b27f8b09a80d0e71 (diff)
downloadbcm5719-llvm-bee05caa6b26cd945efce349dd53285ecae526fa.tar.gz
bcm5719-llvm-bee05caa6b26cd945efce349dd53285ecae526fa.zip
[LibCallSimplifier] propagate FMF when shrinking binary calls
llvm-svn: 256682
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index 2eba5fe31e0..bf158949de0 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -1033,6 +1033,10 @@ Value *LibCallSimplifier::optimizeBinaryDoubleFP(CallInst *CI, IRBuilder<> &B) {
if (V2 == nullptr)
return nullptr;
+ // Propagate fast-math flags from the existing call to the new call.
+ IRBuilder<>::FastMathFlagGuard Guard(B);
+ B.SetFastMathFlags(CI->getFastMathFlags());
+
// fmin((double)floatval1, (double)floatval2)
// -> (double)fminf(floatval1, floatval2)
// TODO: Handle intrinsics in the same way as in optimizeUnaryDoubleFP().
OpenPOWER on IntegriCloud