[PATCH] D89050: Add support for !noundef metatdata on loads
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 26 06:58:25 PST 2022
nikic added a comment.
In D89050#3272418 <https://reviews.llvm.org/D89050#3272418>, @malharJ wrote:
> Hi everyone,
>
> If you would be so kind as to help me out here,
> I'm interested in knowing if it's possible to write C/C++ code in a way that can translate to a load with !noundef metadata ?
>
> (Background:
>
> I came across this patch while debugging an optimization (specifically the select ---> and/or folding) in InstCombine ...
> I am trying to enable that transform and one of the ways I was attempting it was to ensure that the operands of the select instruction
> are well-defined values.
>
> In my case the C/C++ code has array accesses so it translates to loads in the IR, and currently these loads do not have this !noundef metadata
> attached to it so the loaded values can potentially be undef/poison values.
>
> so I am trying to find a way if something in C/C++ code can be written in a way so as to generate loads with this metadata)
I think most loads in C/C++ can be annotated with `!noundef` based on language semantics, but I don't think anyone has looked into the necessary clang frontend work yet. `noundef` on arguments/returns was enabled only very recently.
You might want to file an issue for the missing transform you encountered. There's a chance that we can address it in a different way that does not require noundef.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89050/new/
https://reviews.llvm.org/D89050
More information about the llvm-commits
mailing list