[PATCH] D134410: [clang][CodeGen] Add noundef metadata to load instructions (preliminary 1 or 2)

Nuno Lopes via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 30 15:14:47 PDT 2022


nlopes added a comment.

In D134410#3895077 <https://reviews.llvm.org/D134410#3895077>, @nikic wrote:

> In D134410#3894995 <https://reviews.llvm.org/D134410#3894995>, @nlopes wrote:
>
>> We wanted this patch to make us switch uninitialized loads to poison at will, since they become UB. In practice, this helps us fixing bugs in SROA and etc without perf degradation.
>
> Can you elaborate on this? I don't see how this is necessary for switching uninitialized loads to poison.

It's not mandatory, it's a simple way of achieving it as !noundef already exists.

We cannot change the default behavior of load as it would break BC. An alternative is to introduce a new !poison_on_unint for loads. Clang could use that on all loads except those for bit-fields.
Our suggestion is to jump straight to !noundef.
To fully remove undef, then we need to swtich loads to return `freeze poison` rather than undef on uninitialized access, but only after we are able to yield poison in the common case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134410



More information about the cfe-commits mailing list