[PATCH] D127964: [DCE] Eliminate no-op atan and atan2 calls
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 18 08:40:44 PDT 2022
spatel added a comment.
In D127964#3731720 <https://reviews.llvm.org/D127964#3731720>, @ro wrote:
> The `llvm/test/Transforms/EarlyCSE/atan.ll` test `FAIL`s on Solaris (both sparcv9 and amd64):
>
> /vol/llvm/src/llvm-project/local/llvm/test/Transforms/EarlyCSE/atan.ll:55:15: error: CHECK-NEXT: expected string not found in input
> ; CHECK-NEXT: ret float -0.000000e+00
> ^
>
> Comparing to the Linux/x86_64 version of the output, the only difference is
>
> --- /homes/ro/atan.ll.x86_64 2022-08-18 12:38:48.313115000 +0200
> +++ /homes/ro/atan.ll.sparcv9 2022-08-18 11:50:22.976866000 +0200
> @@ -25,7 +25,8 @@
> }
>
> define float @callatan2_00() {
> - ret float -0.000000e+00
> + %call = call float @atan2f(float -0.000000e+00, float 0.000000e+00)
> + ret float %call
> }
>
> define float @callatan2_x0() {
>
> Any suggestion on how to handle this? Just `XFAIL` the test on Solaris?
That would be the quick fix to get things passing. But does that mean the mathlib on Solaris is setting errno on "atan2(-0.0, 0.0)" ?
IEEE says "atan2(±0, +0) is ±0".
POSIX has that case as optional - https://pubs.opengroup.org/onlinepubs/9699919799/functions/atan2.html :
"If y is ±0 and x is +0, ±0 shall be returned."
And also says:
"If both arguments are 0, a domain error shall not occur."
...but that's in the same optional block.
So the more general fix would be to disallow constant folding on this case (and also on "atan2(+0.0, 0.0)")?
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