This is enabled only under -ffast-math.
So, instead of emitting:
4007b0: 50 push %rax
4007b1: e8 8a fd ff ff callq 400540 <atanf@plt>
4007b6: 58 pop %rax
4007b7: e9 94 fd ff ff jmpq 400550 <tanf@plt>
4007bc: 0f 1f 40 00 nopl 0x0(%rax)
for:
float mytan(float x) {
return tanf(atanf(x));
}
we emit a single retq.
Differential Revision: http://reviews.llvm.org/D14302
llvm-svn: 252098
16 lines
357 B
LLVM
16 lines
357 B
LLVM
; RUN: opt < %s -instcombine -S | FileCheck %s
|
|
|
|
define float @mytan(float %x) #0 {
|
|
entry:
|
|
%call = call float @atanf(float %x)
|
|
%call1 = call float @tanf(float %call)
|
|
ret float %call1
|
|
}
|
|
|
|
; CHECK-LABEL: define float @mytan(
|
|
; CHECK: ret float %x
|
|
|
|
declare float @tanf(float) #0
|
|
declare float @atanf(float) #0
|
|
attributes #0 = { "unsafe-fp-math"="true" }
|