[PATCH] D28335: [WIP] [RFC] Don't lower floating point intrinsics to libcalls which modify errno

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 14:27:12 PST 2017



On 01/05/2017 02:16 PM, Eli Friedman via Phabricator wrote:
> efriedma added a comment.
>
>> I know. I posted an RFC at some point where I detailed how errno is implemented across a wide range of implementations. It is nasty, at least in theory, but practically, it is not as bad as you might fear.
> http://lists.llvm.org/pipermail/llvm-dev/2013-November/068154.html ? It looks like the conclusion was actually that it's worse than that: matherr() exists on both glibc and MSVC, which means sqrt(-1) can do anything.

Sure, but only if the user specifically installs some non-default 
handler function. I think it is completely reasonable for the compiler 
to have a flag, on by default, which means that the users promises that 
he or she did not install some math-error handler function. This is 
something that is under the user's control, and rarely used. This is 
much better than providing the user a flag, -fno-math-errno, which lies 
to the compiler about whether or not the math functions set errno, 
something which is not actually under the user's control, but rather 
just a convenient fiction that normally works.

  -Hal

>
>
> Repository:
>    rL LLVM
>
> https://reviews.llvm.org/D28335
>
>
>

-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-commits mailing list