OSDN Git Service

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)
commit8e620e76a890cadf3f2b50eaa8191e1c093bf6c2
tree52cbb89da799c93d1a6245f34cbd6f320ead3b2e
parent55991dff37f459a81eaa248e5c0d5ec64017e788
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265262 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ValueTracking.cpp
test/Transforms/LICM/hoist-round.ll [new file with mode: 0644]