projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[LibCallSimplifier] use instruction-level fast-math-flags to transform log calls
[oota-llvm.git]
/
lib
/
Transforms
/
Utils
/
SimplifyLibCalls.cpp
diff --git
a/lib/Transforms/Utils/SimplifyLibCalls.cpp
b/lib/Transforms/Utils/SimplifyLibCalls.cpp
index ef700499ef267f30f041683a9b8e3df10ccc771e..24345465cf7c7bc5ba43fbacf0ef4381597075ae 100644
(file)
--- a/
lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/
lib/Transforms/Utils/SimplifyLibCalls.cpp
@@
-1354,11
+1354,13
@@
Value *LibCallSimplifier::optimizeLog(CallInst *CI, IRBuilder<> &B) {
!FT->getParamType(0)->isFloatingPointTy())
return Ret;
!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);
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)
return Ret;
// log(pow(x,y)) -> y*log(x)