diff options
author | Sanjay Patel <spatel@rotateright.com> | 2018-08-13 19:24:41 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2018-08-13 19:24:41 +0000 |
commit | e45a83d4479434d7bd6d7a3adc9e88bc159f2eb1 (patch) | |
tree | a732af733941d2dc432a00b835d0d66e7e70565a /llvm/test/Transforms | |
parent | f138fda5edc21004de744ed354e9142b8c2ee109 (diff) | |
download | bcm5719-llvm-e45a83d4479434d7bd6d7a3adc9e88bc159f2eb1.tar.gz bcm5719-llvm-e45a83d4479434d7bd6d7a3adc9e88bc159f2eb1.zip |
[SimplifyLibCalls] add reflection fold for -sin(-x) (PR38458)
This is a very partial fix for the reported problem. I suspect
we do not get this fold in most motivating cases because most of
the time, the libcall would have been replaced by an intrinsic,
and that optimization is handled elsewhere...but maybe it should
be handled here?
llvm-svn: 339604
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r-- | llvm/test/Transforms/InstCombine/cos-1.ll | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/llvm/test/Transforms/InstCombine/cos-1.ll b/llvm/test/Transforms/InstCombine/cos-1.ll index 293a2401419..daa193b57ef 100644 --- a/llvm/test/Transforms/InstCombine/cos-1.ll +++ b/llvm/test/Transforms/InstCombine/cos-1.ll @@ -52,9 +52,9 @@ define float @cosf_negated_arg_FMF(float %x) { define double @sin_negated_arg(double %x) { ; ANY-LABEL: @sin_negated_arg( -; ANY-NEXT: [[NEG:%.*]] = fsub double -0.000000e+00, [[X:%.*]] -; ANY-NEXT: [[R:%.*]] = call double @sin(double [[NEG]]) -; ANY-NEXT: ret double [[R]] +; ANY-NEXT: [[SIN:%.*]] = call double @sin(double [[X:%.*]]) +; ANY-NEXT: [[TMP1:%.*]] = fsub double -0.000000e+00, [[SIN]] +; ANY-NEXT: ret double [[TMP1]] ; %neg = fsub double -0.0, %x %r = call double @sin(double %neg) @@ -63,9 +63,9 @@ define double @sin_negated_arg(double %x) { define float @sinf_negated_arg(float %x) { ; ANY-LABEL: @sinf_negated_arg( -; ANY-NEXT: [[NEG:%.*]] = fsub float -0.000000e+00, [[X:%.*]] -; ANY-NEXT: [[R:%.*]] = call float @sinf(float [[NEG]]) -; ANY-NEXT: ret float [[R]] +; ANY-NEXT: [[SIN:%.*]] = call float @sinf(float [[X:%.*]]) +; ANY-NEXT: [[TMP1:%.*]] = fsub float -0.000000e+00, [[SIN]] +; ANY-NEXT: ret float [[TMP1]] ; %neg = fsub float -0.0, %x %r = call float @sinf(float %neg) @@ -92,10 +92,8 @@ define double @sin_negated_arg_extra_use(double %x) { define double @neg_sin_negated_arg(double %x) { ; ANY-LABEL: @neg_sin_negated_arg( -; ANY-NEXT: [[NEG:%.*]] = fsub double -0.000000e+00, [[X:%.*]] -; ANY-NEXT: [[R:%.*]] = call double @sin(double [[NEG]]) -; ANY-NEXT: [[RN:%.*]] = fsub double -0.000000e+00, [[R]] -; ANY-NEXT: ret double [[RN]] +; ANY-NEXT: [[SIN:%.*]] = call double @sin(double [[X:%.*]]) +; ANY-NEXT: ret double [[SIN]] ; %neg = fsub double -0.0, %x %r = call double @sin(double %neg) |