[llvm] clarify semantics of masked vector load/store (PR #82469)

Ralf Jung via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 04:29:37 PST 2024


RalfJung wrote:

> a major difference between the two choices is that doing a masked load on a pointer before the beginning of it's allocation is disallowed with inbounds, but allowed without inbounds as long as vector elements are masked-off until the offset is big enough to be in the allocation's bounds.

Yes that is indeed the key point: if the first half of the vector is masked-off, and that first half is actually out-of-bounds, then the pointer itself is conceptually out-of-bounds and "computing the pointer to the actually loaded element" would be a non-inbounds pointer computation. I expect this usecase to be allowed, which is why I added

> Only the masked-on lanes of the vector need to be inbounds of an allocation (but all these lanes need to be inbounds of the same allocation).

https://github.com/llvm/llvm-project/pull/82469


More information about the llvm-commits mailing list