[PATCH] D127964: [DCE] Eliminate no-op atan and atan2 calls
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 19 09:35:53 PDT 2022
spatel added a comment.
In D127964#3735267 <https://reviews.llvm.org/D127964#3735267>, @ro wrote:
> I've looked around some more and it seems the Solaris `libm` acts within the C standard: all of C99, p.219, C11, p.239, and C17, p.147 state
>
> A domain error may occur if both arguments are zero.
>
> I've also found the atan2 docs on cppreference.com <https://en.cppreference.com/w/c/numeric/math/atan2> which says the same, adding
>
> If the implementation supports IEEE floating-point arithmetic (IEC 60559),
>
> If x and y are both zero, domain error does not occur
> If x and y are both zero, range error does not occur either
>
> IEC 60559 support thus seems to be lacking on Solaris and, given that's it's optional, the LLVM testsuite should cope either way.
Thanks for checking. I added tests and avoided folding on these patterns:
4bff1037bbfc3 <https://reviews.llvm.org/rG4bff1037bbfc31d6ff588a19b41f7f7f76bdeefb>
7f1262a322c0 <https://reviews.llvm.org/rG7f1262a322c0d80f34964004dbd3ebec58404a5f>
In the initial review, we misinterpreted the POSIX docs because the optional behavior specifier for raising errors is easily missed. If there are other cases where this patch overstepped, we should fix those too.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127964/new/
https://reviews.llvm.org/D127964
More information about the llvm-commits
mailing list