[Mlir-commits] [clang] [llvm] [mlir] Extend MemoryEffects to Support Target-Specific Memory Locations (PR #148650)

Paul Walker llvmlistbot at llvm.org
Fri Oct 24 09:28:18 PDT 2025


================
@@ -2220,6 +2221,23 @@ For example:
       accessing inaccessible memory itself). Inaccessible memory is often used
       to model control dependencies of intrinsics.
     - ``errnomem``: This refers to accesses to the ``errno`` variable.
+    - ``target_mem0`` and ``target_mem1``: This refers to additional memory 
+      locations that are needed by targets to define memory effects on
+      architectural resources that are neither regular argument/global memory
+      nor ``inaccessiblemem``/``errnomem``.
+
+    As with other location kinds, an omitted location inherits the default access
+    (e.g. from ``memory(read)``), and an explicit access like ``target_mem0: none``
+    indicates that location is not affected.
+    **Examples:**
+
+    A call that may read any memory, and additionally writes only the target_mem0 state::
+
+        declare void @foo()
+        ; ...
+        ; Only target_mem0 writes are observable; no writes to regular memory are implied.
+        attributes #0 = { memory(read, target_mem0: write) }
+
----------------
paulwalker-arm wrote:

I don't think you need to be overly verbose here.  Something simple like:
-target_mem# : These refer to target specific state that cannot be accessed by any other means. # is a number between 0 and 1 inclusive.

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


More information about the Mlir-commits mailing list