[PATCH] D103169: [FPEnv][InstSimplify] Constrained FP support for NaN
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 15 09:33:58 PDT 2021
spatel added a comment.
In D103169#2880438 <https://reviews.llvm.org/D103169#2880438>, @kpn wrote:
> Well, OK, partially wrong. The undef question needs to be answered, yes. But what we really need is to hook into the constant folding that we're reaching via foldOrCommuteConstant() but are currently avoiding except in the default FP environment. That'll take longer to fix, but D102673 <https://reviews.llvm.org/D102673> is a step in the right direction.
The problem for this example is that we are not passing FMF through to constant folding. The fmul has `ninf` with an INF operand, so that's poison:
https://alive2.llvm.org/ce/z/DTvAX4
We get that result accidentally at the moment for constrained ops because we don't have constant folding for constrained ops. Once we land D102673 <https://reviews.llvm.org/D102673>, the result for constrained ops will change to NaN. So we'll be consistent, but not ideal for both cases. :)
Returning NaN is not a miscompile because we can soften poison to whatever we want, but it's not as strong an optimization as folding to poison.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103169/new/
https://reviews.llvm.org/D103169
More information about the llvm-commits
mailing list