llvm/test/Transforms/InstCombine/pr26993.ll
David Majnemer 649040b838 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263875 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-19 04:53:02 +00:00

25 lines
613 B
LLVM

; 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 }