Mark some FP intrinsics as safe to speculatively execute
authorPeter Zotov <whitequark@whitequark.org>
Sun, 3 Apr 2016 12:30:46 +0000 (12:30 +0000)
committerPeter Zotov <whitequark@whitequark.org>
Sun, 3 Apr 2016 12:30:46 +0000 (12:30 +0000)
commit0218d0f38355624acbe4960170a97fb67f5af779
tree928453f095dee8da0ab01fc75834339169726eaf
parent2075b5d2a122a3790c05ce12941a738da1a8b205
Mark some FP intrinsics as safe to speculatively execute

Floating point intrinsics in LLVM are generally not speculatively
executed, since most of them are defined to behave the same as libm
functions, which set errno.

However, the only error that can happen  when executing ceil, floor,
nearbyint, rint and round libm functions per POSIX.1-2001 is -ERANGE,
and that requires the maximum value of the exponent to be smaller
than  the number of mantissa bits, which is not the case with any of
the floating point types supported by LLVM.

The trunc and copysign functions never set errno per per POSIX.1-2001.

Differential Revision: http://reviews.llvm.org/D18643

llvm-svn: 265262
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Transforms/LICM/hoist-round.ll [new file with mode: 0644]