[PATCH] D136097: InstSimplify: Fold fdiv nnan nsz x, 0 -> inf

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 17 13:15:41 PDT 2022


nlopes added a comment.

In D136097#3862946 <https://reviews.llvm.org/D136097#3862946>, @spatel wrote:

> In D136097#3862928 <https://reviews.llvm.org/D136097#3862928>, @kpn wrote:
>
>> It looks like by 754 sec 7.3 a (-x)/(+0) == -Inf, but the nsz is documented as saying the sign of the result is "insignificant", so I think we're good here.
>>
>> LGTM
>
> "nsz" means the sign of a **zero** result is insignificant, not any result. -42.0 / 0.0 should be -Inf, not +Inf?

It's documented as ignoring the sign of a zero argument or a zero result.
Thus, when nsw is involved, we should consider the result of -42.0 / 0.0 and -42.0 / -0.0. This case the 0.0 is a constant, but that doesn't matter.

Alive2 is correct here AFAICT.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136097/new/

https://reviews.llvm.org/D136097



More information about the llvm-commits mailing list