[clang] [llvm] [Transforms][Utils][PromoteMem2Reg] Propagate nnan flag on par with the nsz flag (PR #114271)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 08:04:31 PST 2024


arsenm wrote:

> I do think this change still makes sense, especially from a consistency point of view. If SROA sets one of the value-based FMF flags (nsz) then it stands to reason that it should also set the other two (nnan and ninf). Unless there is some reason why nsz would be more problematic than nnan/ninf in this context (it does have substantially different semantics).

nsz is more problematic and difficult to recover than nnan/ninf. Violations of no-nans no-infs can be treated as poison. nsz is fuzzier and just expands the set of permissible values, and is thus attached to specific operations and not recoverable from the inputs. You can't simply add some form of assertion that a value cannot be -0, in the way you could for a nan. 

It's not problematic to preserve nnan in the same way here, but it's also less important.

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


More information about the cfe-commits mailing list