summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-03-19 04:53:02 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-03-19 04:53:02 +0000
commitabae6b588beb31864570c4c09c7335bfd7dd8ae5 (patch)
tree050dd0f247876ef21644920adf37cdc0c1ee82f1 /llvm/test
parentcdf2873e36d0ec51fa02e1713aa34fb6762475c0 (diff)
downloadbcm5719-llvm-abae6b588beb31864570c4c09c7335bfd7dd8ae5.tar.gz
bcm5719-llvm-abae6b588beb31864570c4c09c7335bfd7dd8ae5.zip
[SimplifyLibCalls] Only consider sinpi/cospi functions within the same function
The sinpi/cospi can be replaced with sincospi to remove unnecessary computations. However, we need to make sure that the calls are within the same function! This fixes PR26993. llvm-svn: 263875
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/InstCombine/pr26993.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/pr26993.ll b/llvm/test/Transforms/InstCombine/pr26993.ll
new file mode 100644
index 00000000000..14b33d10cc3
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/pr26993.ll
@@ -0,0 +1,24 @@
+; RUN: opt -instcombine -S < %s | FileCheck %s
+
+define double @test1() {
+ %sin = call double @__sinpi(double 1.0)
+ ret double %sin
+}
+
+; CHECK-LABEL: define double @test1(
+; CHECK: %[[sin:.*]] = call double @__sinpi(double 1.000000e+00)
+; CHECK-NEXT: ret double %[[sin]]
+
+define double @test2() {
+ %cos = call double @__cospi(double 1.0)
+ ret double %cos
+}
+
+; CHECK-LABEL: define double @test2(
+; CHECK: %[[cos:.*]] = call double @__cospi(double 1.000000e+00)
+; CHECK-NEXT: ret double %[[cos]]
+
+declare double @__sinpi(double %x) #0
+declare double @__cospi(double %x) #0
+
+attributes #0 = { readnone nounwind }
OpenPOWER on IntegriCloud