llvm-6502/test/Transforms/InstCombine/fold-calls.ll
Jakob Stoklund Olesen 1f386c4ce1 Don't try to constant fold libm functions with non-finite arguments.
Usually we wouldn't do this anyway because llvm_fenv_testexcept would return an
exception, but we have seen some cases where neither errno nor fenv detect an
exception on arm-linux.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114893 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27 21:29:20 +00:00

20 lines
433 B
LLVM

; RUN: opt -instcombine -S < %s | FileCheck %s
; This shouldn't fold, because sin(inf) is invalid.
; CHECK: @foo
; CHECK: %t = call double @sin(double 0x7FF0000000000000)
define double @foo() {
%t = call double @sin(double 0x7FF0000000000000)
ret double %t
}
; This should fold.
; CHECK: @bar
; CHECK: ret double 0.0
define double @bar() {
%t = call double @sin(double 0.0)
ret double %t
}
declare double @sin(double)