[PATCH] D136284: SROA should freeze undefs for loads with no prior stores

Jamie Schmeiser via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 21 06:44:49 PDT 2022


jamieschmeiser added a comment.

In D136284#3869216 <https://reviews.llvm.org/D136284#3869216>, @nikic wrote:

> The current behavior here is intentional -- in fact, LLVM will move towards returning poison for loads from uninitialized memory in the future (though precisely how this will happen is still uncertain, see https://discourse.llvm.org/t/rfc-making-bit-field-codegen-poison-compatible/63250 for some recent discussion on the topic).

The current behaviour implies that the content of uninitialized memory is volatile, which is not correct.  One would still need the freeze to ensure that 2 loads of the same uninitialized memory are the same, whether this is undef or poison.  So this would not affect that future change and would still be required.  Besides, are you sure that poison is appropriate here?  Loading uninitialized memory is not erroneous; it is undefined.  Comparing the same uninitialized memory, however, is defined, hence the freeze.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136284/new/

https://reviews.llvm.org/D136284



More information about the cfe-commits mailing list