[llvm] [LangRef] Clarify nsz semantics (PR #180906)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 12 02:09:17 PST 2026


nikic wrote:

> ISTM that a guarantee of consistent output (from e.g. fabs) isn't be particularly useful from a user point-of-view, so long as a phi (marked nsz) can change the sign arbitrarily anyhow.
> [...]
> That said, since this clarification seems aimed at making it easier to write correct analyses easier inside LLVM, rather than making user-level semantics easier to understand, it does seem plausible.

Yes, I don't think that the input/output distinction is meaningful from a user perspective, this is just to avoid at least some of the issues we currently have with nsz related miscompilations on the IR level.

nsz generally has more non-determinism than we actually want, but I'm not sure how we can reduce it further, without giving up on operational semantics for nsz entirely, and making it a vibes-based rewrite flag instead...

https://github.com/llvm/llvm-project/pull/180906


More information about the llvm-commits mailing list