[llvm] [LangRef] asm clobber constrains: '~memory' allows reads and synchronization (PR #150191)
Ralf Jung via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 14 01:36:14 PDT 2026
================
@@ -5635,10 +5635,13 @@ Clobber constraints
A clobber constraint is indicated by a "``~``" prefix. A clobber does not
consume an input operand, nor generate an output. Clobbers cannot use any of the
general constraint code letters -- they may use only explicit register
-constraints, e.g., "``~{eax}``". The one exception is that a clobber string of
-"``~{memory}``" indicates that the assembly writes to arbitrary undeclared
-memory locations -- not only the memory pointed to by a declared indirect
-output.
+constraints, e.g., "``~{eax}``".
+
+The one exception is that a clobber string of "``~{memory}``" indicates that the
+assembly reads and writes arbitrary undeclared memory locations -- not only the
+memory pointed to by a declared indirect output. Furthermore, the assembly may
+also cause synchronization with other threads, such as via release/acquire
+fences and atomic memory accesses.
----------------
RalfJung wrote:
> You're saying that with the memory clobber it's okay to write assembly that performs synchronization.
Yes, exactly. It's the most plausible candidate for a clobber that allows this.
https://github.com/llvm/llvm-project/pull/150191
More information about the llvm-commits
mailing list