[llvm] [InferAddressSpaces] Check volatile support in the destination AS (PR #224702)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 02:13:32 PDT 2026


https://github.com/antoniofrighetto approved this pull request.

LGTM

> I still think the existence of this TTI hook is dodgy and we shouldn't touch volatile operations, regardless of target preference

@arsenm I'm not sure I interiorized why the target-specific exception wording was introduced in https://reviews.llvm.org/D63525. Was it essentially added to allow this TTI hook? I wonder whether the rule could be better stated as something around the following lines:

> The address space of a volatile operation may not be changed unless the target guarantees that a volatile access through the new address space is observably equivalent to the original.

If so, I think having something like, e.g., isVolatileAccessPreservedAcrossAddressSpace() would be acceptable. Conversely, if the middle-end should never change volatile address spaces, then NVPTX would be responsible for rewriting cvta + ld.volatile into ld.volatile.shared (largely defeating the purpose of InferAddressSpaces for volatile accesses though, which seems to me somewhat of a legitimate use case.)

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


More information about the llvm-commits mailing list