[llvm] [GVN] Freeze value if `undef` when forwarding local memset to loads (PR #91376)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 07:13:35 PDT 2024


antoniofrighetto wrote:

> Is this fixing an end-to-end miscompile? Or just an alive2 report?

It fixes an Alive2 report, and I think it should fix end-to-end miscompilations that may happen when reading from uninit memory, or undef gets propagated to the memset (or so long as we do not DetermineNoUndef when constructing the attribute list if the char value is passed as function parameter, not sure if it can be the case for ScalarTypes though).

> I don't really want to have any partial fixes around the handling of undef/poison and uninitialized memory in GVN, before we have a plan on how we're going to handle this in general.

Makes sense, although I suspect we would end up with isGuaranteedNotToBePoison/isGuaranteedNotToBeUndef here anyways.

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


More information about the llvm-commits mailing list