[PATCH] D101727: Fix PR47960 - Incorrect transformation of fabs with nnan flag
Nuno Lopes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 14 08:41:47 PDT 2021
nlopes added a subscriber: regehr.
nlopes added a comment.
In D101727#2759617 <https://reviews.llvm.org/D101727#2759617>, @spatel wrote:
> In D101727#2746020 <https://reviews.llvm.org/D101727#2746020>, @nlopes wrote:
>
>> FYI just added support for select w/ fast-math to Alive2 so we can check these tests.
>
> Great! Is it available on the online instance yet?
> Checking my understanding on this example:
> https://alive2.llvm.org/ce/z/M2Fe49
>
> define double @src(double %x) {
> %0:
> %lezero = fcmp ole double %x, 0.000000
> %negx = fsub nnan double 0.000000, %x
> %fabs = select i1 %lezero, double %negx, double %x
> ret double %fabs
> }
> =>
> define double @tgt(double %x) {
> %0:
> %fabs = fabs nnan double %x
> ret double %fabs
> }
> Transformation doesn't verify!
>
> ERROR: Target is more poisonous than source
>
> Example:
> double %x = NaN
>
> Source:
> i1 %lezero = #x0 (0)
> double %negx = poison
> double %fabs = NaN
>
> Target:
> double %fabs = poison
> Source value: NaN
> Target value: poison
>
> In the source function, if we have "nnan" on the select, and we choose %x (NaN), then the return value must be poison? The "nnan" on the select was dropped in the output pane though?
Your example is correct, yes! Thanks for checking.
There are actually two issues:
- There was a typo in the select fast-math implementation, which I've just fixed.
- The online version hasn't been updated in a while. 'nnan' should appear in the output, so the online version is before the fast-math changes. Pinging @regehr so he updates the online Alive2 when he has time.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101727/new/
https://reviews.llvm.org/D101727
More information about the llvm-commits
mailing list