[llvm] [RFC] IR: Define noalias.addrspace metadata (PR #102461)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 11 13:17:03 PDT 2024
================
@@ -5180,6 +5206,13 @@ void Verifier::visitInstruction(Instruction &I) {
visitRangeMetadata(I, Range, I.getType());
}
+ if (MDNode *Range = I.getMetadata(LLVMContext::MD_noalias_addrspace)) {
+ Check(isa<LoadInst>(I) || isa<StoreInst>(I) || isa<AtomicRMWInst>(I) ||
+ isa<AtomicCmpXchgInst>(I) || isa<CallInst>(I),
+ "noalias.addrspace are only for memory operations!", &I);
+ visitNoaliasAddrspaceMetadata(I, Range, I.getType());
----------------
jurahul wrote:
Ok. I can see that for say things like function or intrinsics, where they accept a pointer in address space 'n' but also assert that its underlying address space is not 'n' and access it internally using another address space (so the pointer is pure bit container to pass some data into the function or intrinsic). But for native LLVM insts, like `LoadInst` when would it make sense to have its pointer operand in addspace(n) and also have the `noalias.addrspace` metadata listing n? I guess we are calling it undefined behavior but still valid IR?
https://github.com/llvm/llvm-project/pull/102461
More information about the llvm-commits
mailing list