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

Nuno Lopes via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 21 07:33:56 PDT 2022


nlopes added a comment.

In D136284#3874596 <https://reviews.llvm.org/D136284#3874596>, @jamieschmeiser wrote:

> In D136284#3874492 <https://reviews.llvm.org/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 exception are "copy-like" operations on unsigned character types, which comparisons do not fall under.
>>
>> I believe the C specification is less clear cut about this, but Clang and LLVM assume basically the same to also hold for C code.
>
> What version of the C++ standard is this?  Every version that I have seen has basics as section 3 and I cannot find this section, nor anything similar.  Section 6 is Statements.

That discussion is orthogonal to this patch.
This patch is not desired because it's not needed per the current LLVM IR semantics. If you want to change something, you need to start by proposing a change to the LLVM IR semantics. You'll need to justify why it's needed, why it's correct, the perf impact, how to make it backwards compatible, why it's better than the proposals over the table right now.

Anyway, a patch like this solves no problem. LLVM allows loads to be duplicated. Your patch does nothing to prevent that and to ensure all loads see the same value. The issue is way more complicated than what this patch implies.


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