[llvm] [LangRef] Spell out alias attribute/metadata violations are UB. (PR #116220)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 14 07:12:45 PST 2024
nikic wrote:
Trying to remind myself why exactly using "load is poison, store is UB" semantics wouldn't work:
If we have
```
store v2, p
v = load p
```
where we have claimed that these are noalias, then the `store` is well-defined and the `load` returns poison (due to conflicting store).
If we now move the load above the store (because they don't alias)
```
v = load p
store v2, p
```
then `load` returns a value and `store` is UB due to conflicting prior store. So we went from poison to UB.
So I believe that for scoped alias metadata only UB semantics can work, as specified here. Presumably a similar argument generalizes to the other metadata.
https://github.com/llvm/llvm-project/pull/116220
More information about the llvm-commits
mailing list