diff options
author | Sanjay Patel <spatel@rotateright.com> | 2016-01-05 20:46:19 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2016-01-05 20:46:19 +0000 |
commit | 29095ea1b0d17e85c7feb56b05cf861b819a39cc (patch) | |
tree | ae6939549c84072b22d8fb19c4f446ca9e2deca4 /llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | |
parent | 6035504ab32cec45c93f3193c62a8d91a83f4159 (diff) | |
download | bcm5719-llvm-29095ea1b0d17e85c7feb56b05cf861b819a39cc.tar.gz bcm5719-llvm-29095ea1b0d17e85c7feb56b05cf861b819a39cc.zip |
[LibCallSimplfier] use instruction-level fast-math-flags for fmin/fmax transforms
llvm-svn: 256871
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp index bf158949de0..5004b74fbae 100644 --- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp @@ -1317,14 +1317,12 @@ Value *LibCallSimplifier::optimizeFMinFMax(CallInst *CI, IRBuilder<> &B) { IRBuilder<>::FastMathFlagGuard Guard(B); FastMathFlags FMF; - Function *F = CI->getParent()->getParent(); - if (canUseUnsafeFPMath(F)) { + if (CI->hasUnsafeAlgebra()) { // Unsafe algebra sets all fast-math-flags to true. FMF.setUnsafeAlgebra(); } else { // At a minimum, no-nans-fp-math must be true. - Attribute Attr = F->getFnAttribute("no-nans-fp-math"); - if (Attr.getValueAsString() != "true") + if (!CI->hasNoNaNs()) return nullptr; // No-signed-zeros is implied by the definitions of fmax/fmin themselves: // "Ideally, fmax would be sensitive to the sign of zero, for example |