diff options
author | Sanjay Patel <spatel@rotateright.com> | 2016-01-11 23:31:48 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2016-01-11 23:31:48 +0000 |
commit | e896ede7f1e0592b55e824a6ef7fdbd63fa3d1e7 (patch) | |
tree | 1ad1c9a272b2bce8a93258f277e4d6a49ef33ba5 /llvm/lib/Transforms | |
parent | 7bf779859a2c90017796c55d18b53ff00c27c9bf (diff) | |
download | bcm5719-llvm-e896ede7f1e0592b55e824a6ef7fdbd63fa3d1e7.tar.gz bcm5719-llvm-e896ede7f1e0592b55e824a6ef7fdbd63fa3d1e7.zip |
[LibCallSimplifier] use instruction-level fast-math-flags to transform log calls
Also, add tests to verify that we're checking 'fast' on both calls of each transform pair,
tighten the CHECK lines, and give the tests more meaningful names.
This is a continuation of:
http://reviews.llvm.org/rL255555
http://reviews.llvm.org/rL256871
http://reviews.llvm.org/rL256964
http://reviews.llvm.org/rL257400
http://reviews.llvm.org/rL257404
llvm-svn: 257414
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp index ef700499ef2..24345465cf7 100644 --- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp @@ -1354,11 +1354,13 @@ Value *LibCallSimplifier::optimizeLog(CallInst *CI, IRBuilder<> &B) { !FT->getParamType(0)->isFloatingPointTy()) return Ret; - if (!canUseUnsafeFPMath(CI->getParent()->getParent())) + if (!CI->hasUnsafeAlgebra()) return Ret; Value *Op1 = CI->getArgOperand(0); auto *OpC = dyn_cast<CallInst>(Op1); - if (!OpC) + + // The earlier call must also be unsafe in order to do these transforms. + if (!OpC || !OpC->hasUnsafeAlgebra()) return Ret; // log(pow(x,y)) -> y*log(x) |