[PATCH] These builtin functions set errno. Mark them accordingly.
Chris Lattner
clattner at apple.com
Mon May 19 16:37:46 PDT 2014
On May 19, 2014, at 10:05 AM, Hal Finkel <hfinkel at anl.gov> wrote:
>>>
>>> I'm not going to push this patch further because it's not the right
>>> solution. In theory, I believe it is correct, but it breaks the
>>> __buitlin escape hatch, which would likely result in serious
>>> performance degradations.
>>
>> I don’t think this is a good solution. The better option here is to
>> tell people to use -fno-math-errno if they don’t care about libm
>> functions setting errno.
>
> But this is the chicken and egg problem: is __builtin_sqrt a libm function? The problem that we currently have, IIUC, is that the answer is *sometimes*.
I don’t really care about the builtin, it is a transient part of the AST and having the attributes on it be changed when -fno-math-errno is set is natural and probably already done.
At the IR level, we already have attributes to model both states: llvm.sqrt when set to readnone doesn’t modify errno.
-Chris
More information about the cfe-commits
mailing list