summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-08-13 21:49:19 +0000
committerSanjay Patel <spatel@rotateright.com>2018-08-13 21:49:19 +0000
commit15bff18c6f2c1e68f9b25110824e384115925461 (patch)
tree4cc9b62ce51b5fd8e48e3f24605ff811845327d5 /llvm/lib/Transforms
parent7136abff1cbcd22e039356fce4e2939dfd65d82d (diff)
downloadbcm5719-llvm-15bff18c6f2c1e68f9b25110824e384115925461.tar.gz
bcm5719-llvm-15bff18c6f2c1e68f9b25110824e384115925461.zip
[SimplifyLibCalls] don't drop fast-math-flags on trig reflection folds (retry r339608)
Even though this code is below a function called optimizeFloatingPointLibCall(), we apparently can't guarantee that we're dealing with FPMathOperators, so bail out immediately if that's not true. llvm-svn: 339618
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index eda3f059e69..a2e5f8d00f6 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -1124,7 +1124,12 @@ Value *LibCallSimplifier::optimizeCAbs(CallInst *CI, IRBuilder<> &B) {
static Value *optimizeTrigReflections(CallInst *Call, LibFunc Func,
IRBuilder<> &B) {
- // FIXME: This drops FMF.
+ if (!isa<FPMathOperator>(Call))
+ return nullptr;
+
+ IRBuilder<>::FastMathFlagGuard Guard(B);
+ B.setFastMathFlags(Call->getFastMathFlags());
+
// TODO: Add tan() and other calls.
// TODO: Can this be shared to also handle LLVM intrinsics?
Value *X;
OpenPOWER on IntegriCloud