diff options
author | Davide Italiano <davide@freebsd.org> | 2017-01-10 18:02:05 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2017-01-10 18:02:05 +0000 |
commit | f8711f093e04fc6d2f24a442a21d516a83c87981 (patch) | |
tree | 8279f5aa2edba078afad2e3f58b40d720a2280b0 /llvm/lib/Transforms/Utils | |
parent | 44bfe03da948871100c09f132e95c21e7d7297ba (diff) | |
download | bcm5719-llvm-f8711f093e04fc6d2f24a442a21d516a83c87981.tar.gz bcm5719-llvm-f8711f093e04fc6d2f24a442a21d516a83c87981.zip |
[SimplifyLibCalls] Propagate fast math flags while optimizing pow().
llvm-svn: 291577
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp index 5237ce5b399..8eaeb1073a7 100644 --- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp @@ -1139,6 +1139,10 @@ Value *LibCallSimplifier::optimizePow(CallInst *CI, IRBuilder<> &B) { !V.isInteger()) return nullptr; + // Propagate fast math flags. + IRBuilder<>::FastMathFlagGuard Guard(B); + B.setFastMathFlags(CI->getFastMathFlags()); + // We will memoize intermediate products of the Addition Chain. Value *InnerChain[33] = {nullptr}; InnerChain[1] = Op1; @@ -1149,7 +1153,6 @@ Value *LibCallSimplifier::optimizePow(CallInst *CI, IRBuilder<> &B) { bool ignored; V.convert(APFloat::IEEEdouble(), APFloat::rmTowardZero, &ignored); - // TODO: Should the new instructions propagate the 'fast' flag of the pow()? Value *FMul = getPow(InnerChain, V.convertToDouble(), B); // For negative exponents simply compute the reciprocal. if (Op2C->isNegative()) |