[llvm] [IR] Introduce intrinsics to model allocator provenance semantics (PR #228048)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 05:02:38 PDT 2026


================
@@ -892,6 +892,13 @@ MemoryEffects BasicAAResult::getMemoryEffects(const Function *F) {
     // inaccessible memory to model control dependence.
     return MemoryEffects::readOnly() |
            MemoryEffects::inaccessibleMemOnly(ModRefInfo::ModRef);
+  case Intrinsic::provenance_dealloc:
+    // The effects of dealloc also extend to the parent allocation, whose
+    // access permissions it restores. The parent is not memory accessible
+    // through the argument (as the latter carries the child provenance), and
+    // thus it is encompassed in other memory.
+    return F->getMemoryEffects() |
+           MemoryEffects::otherMemOnly(ModRefInfo::ModRef);
----------------
antoniofrighetto wrote:

My understanding is that `memory(argmem: readwrite, inaccessiblemem: readwrite)` is not enough for dealloc, as parent's bytes cannot be reached via argmem (through the argument’s provenance). Adhered to the RFC here, though I believe we might want to drop this and remove `IntrInaccessibleMemOrArgMemOnly` from dealloc declaration instead (and, of course, drop it from LangRef too).

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


More information about the llvm-commits mailing list