[llvm] [LangRef] Clarify specification for float min/max operations (PR #172012)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 12 12:59:43 PST 2025
nikic wrote:
> So if it's nondeterministic, what do we constant fold to for a signaling nan?
Either option would be legal. I think using the IEEE 2008 sNaN semantics might be slightly preferable to match the constrained variants. Or we could also uphold https://github.com/llvm/llvm-project/pull/170181 as a permanent rather than temporary change, and just not fold sNaN arguments for these intrinsics at all.
> We also need to ensure that scalar evolution is aware of all this non-determinism and doesn't try to predict what these operations do. With `nsz` they are non-deterministic even for non-NaN inputs, which is unusual.
Currently we conservatively assume that all FP libcalls/intrinsics are non-deterministic:
https://github.com/llvm/llvm-project/blob/f3c16454b4f78f286e9b95a65b3c6be92465b948/llvm/lib/Analysis/ConstantFolding.cpp#L4540-L4544
https://github.com/llvm/llvm-project/pull/172012
More information about the llvm-commits
mailing list