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

2022-10-21 Thread Jamie Schmeiser via Phabricator via cfe-commits
jamieschmeiser added a comment. Yes, I agree it is incomplete (aside from being incorrect here :-) I've just been asking to ensure that my understanding of freeze is correct. Thanks. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136284/new/ http

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

2022-10-21 Thread Nuno Lopes via Phabricator via cfe-commits
nlopes added a comment. In D136284#3874755 , @jamieschmeiser wrote: > In D136284#3874614 , @nlopes wrote: > >> In D136284#3874596 , >> @jamieschmeiser wrote: >> >>> In D

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

2022-10-21 Thread Jamie Schmeiser via Phabricator via cfe-commits
jamieschmeiser added a comment. In D136284#3874614 , @nlopes wrote: > In D136284#3874596 , > @jamieschmeiser wrote: > >> In D136284#3874492 , @nikic wrote: >> >>> At leas

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

2022-10-21 Thread Jamie Schmeiser via Phabricator via cfe-commits
jamieschmeiser abandoned this revision. jamieschmeiser added a comment. I checked with a member of the C++ standards committee and he verified that comparing an uninitialized value against itself is, indeed, undefined behaviour, in the general case. I am abandoning this revision. Repository:

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

2022-10-21 Thread Nuno Lopes via Phabricator via cfe-commits
nlopes added a comment. In D136284#3874596 , @jamieschmeiser wrote: > In D136284#3874492 , @nikic wrote: > >> At least in C++, working with uninitialized memory is pretty much always >> immediate undefined behav

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

2022-10-21 Thread Jamie Schmeiser via Phabricator via cfe-commits
jamieschmeiser added a comment. In D136284#3874492 , @nikic wrote: > At least in C++, working with uninitialized memory is pretty much always > immediate undefined behavior, see https://eel.is/c++draft/basic.indet for the > relevant wording. The only ex

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

2022-10-21 Thread Nikita Popov via Phabricator via cfe-commits
nikic added a comment. At least in C++, working with uninitialized memory is pretty much always immediate undefined behavior, see https://eel.is/c++draft/basic.indet for the relevant wording. The only exception are "copy-like" operations on unsigned character types, which comparisons do not fal

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

2022-10-21 Thread Jamie Schmeiser via Phabricator via cfe-commits
jamieschmeiser added a comment. In 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 happe

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

2022-10-21 Thread Jamie Schmeiser via Phabricator via cfe-commits
jamieschmeiser added a comment. In D136284#3869306 , @nlopes wrote: >> However, multiple loads of the same memory must be equal > > This premise is incorrect w.r.t. with current semantics, which say that loads > return undef for uninit memory. > > As Nik

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

2022-10-19 Thread Nuno Lopes via Phabricator via cfe-commits
nlopes requested changes to this revision. nlopes added a comment. > However, multiple loads of the same memory must be equal This premise is incorrect w.r.t. with current semantics, which say that loads return undef for uninit memory. As Nikita mentioned we are working towards changing this se

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

2022-10-19 Thread Nikita Popov via Phabricator via cfe-commits
nikic requested changes to this revision. nikic added a reviewer: nlopes. nikic added a comment. This revision now requires changes to proceed. The current behavior here is intentional -- in fact, LLVM will move towards returning poison for loads from uninitialized memory in the future (though p

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

2022-10-19 Thread Jamie Schmeiser via Phabricator via cfe-commits
jamieschmeiser created this revision. jamieschmeiser added reviewers: nikic, tstellar. Herald added subscribers: nlopes, kosarev, kerbowa, hiraditya, arichardson, jvesely. Herald added a project: All. jamieschmeiser requested review of this revision. Herald added projects: clang, LLVM. Herald adde