diff options
author | Sanjay Patel <spatel@rotateright.com> | 2018-08-13 20:20:38 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2018-08-13 20:20:38 +0000 |
commit | 66c6fe65347989d0d71a2f115c5a83193d0f1b77 (patch) | |
tree | c2f6c50f9614aceb47091cfc4cdd970106dbcdaf | |
parent | 981f50919e20af957dc147ec429ef0cd397e49f6 (diff) | |
download | bcm5719-llvm-66c6fe65347989d0d71a2f115c5a83193d0f1b77.tar.gz bcm5719-llvm-66c6fe65347989d0d71a2f115c5a83193d0f1b77.zip |
revert r339608 - [SimplifyLibCalls] don't drop fast-math-flags on trig reflection folds
Can't set the builder flags without knowing this is an FPMathOperator. I'll add a test
for that and try again.
llvm-svn: 339609
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | 4 | ||||
-rw-r--r-- | llvm/test/Transforms/InstCombine/cos-1.ll | 13 |
2 files changed, 2 insertions, 15 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp index 599d50b46cb..eda3f059e69 100644 --- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp @@ -1124,9 +1124,7 @@ Value *LibCallSimplifier::optimizeCAbs(CallInst *CI, IRBuilder<> &B) { static Value *optimizeTrigReflections(CallInst *Call, LibFunc Func, IRBuilder<> &B) { - IRBuilder<>::FastMathFlagGuard Guard(B); - B.setFastMathFlags(Call->getFastMathFlags()); - + // FIXME: This drops FMF. // TODO: Add tan() and other calls. // TODO: Can this be shared to also handle LLVM intrinsics? Value *X; diff --git a/llvm/test/Transforms/InstCombine/cos-1.ll b/llvm/test/Transforms/InstCombine/cos-1.ll index 8c9a5d81b73..daa193b57ef 100644 --- a/llvm/test/Transforms/InstCombine/cos-1.ll +++ b/llvm/test/Transforms/InstCombine/cos-1.ll @@ -40,7 +40,7 @@ define float @cosf_negated_arg(float %x) { define float @cosf_negated_arg_FMF(float %x) { ; ANY-LABEL: @cosf_negated_arg_FMF( -; ANY-NEXT: [[COS:%.*]] = call reassoc nnan float @cosf(float [[X:%.*]]) +; ANY-NEXT: [[COS:%.*]] = call float @cosf(float [[X:%.*]]) ; ANY-NEXT: ret float [[COS]] ; %neg = fsub float -0.0, %x @@ -72,17 +72,6 @@ define float @sinf_negated_arg(float %x) { ret float %r } -define float @sinf_negated_arg_FMF(float %x) { -; ANY-LABEL: @sinf_negated_arg_FMF( -; ANY-NEXT: [[SIN:%.*]] = call nnan afn float @sinf(float [[X:%.*]]) -; ANY-NEXT: [[TMP1:%.*]] = fsub nnan afn float -0.000000e+00, [[SIN]] -; ANY-NEXT: ret float [[TMP1]] -; - %neg = fsub ninf float -0.0, %x - %r = call afn nnan float @sinf(float %neg) - ret float %r -} - declare void @use(double) define double @sin_negated_arg_extra_use(double %x) { |