[llvm] [RFC] IR: Define noalias.addrspace metadata (PR #102461)

Harald van Dijk via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 11 13:32:29 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());
----------------
hvdijk wrote:

Address spaces may overlap, a pointer to one address space may point to an object defined in another address space. A `load` instruction that acts on a pointer to one address space, and asserts that the pointer does not point to an object defined in that address space, could presumably still have well-defined behaviour if the pointed-to object is defined in another address space but is accessible through multiple address spaces.

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


More information about the llvm-commits mailing list