[llvm] [docs] Reflect C++'s read-write and write-read coherence rules in the LLVM memory model (PR #217849)

Fabian Ritter via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 23 23:53:06 PDT 2026


================
@@ -4170,10 +4170,23 @@ happens-before must be perfectly overlapping to act atomically.
     read-modify-write operation M ({ref}`cmpxchg <i_cmpxchg>` and
     {ref}`atomicrmw <i_atomicrmw>`) reads from a perfectly overlapping
     `monotonic` (or stronger) write W, W must be immediately before M in
-    the relevant modification order. If one atomic read happens before
-    another perfectly overlapping atomic read and both are at least
-    `monotonic`, the later read must not see an earlier value in the
-    address's modification order. This disallows reordering of perfectly
+    the relevant modification order.
+
+    Atomic accesses that are `monotonic` (or stronger) satisfy coherence rules:
+    - read-read coherence: If one atomic read happens before another
+        perfectly overlapping atomic read and both are at least
+        `monotonic`, the later read must not see an earlier value in the
+        address's modification order.
----------------
ritter-x2a wrote:

I've updated this sentence, but in a slightly different way (with identifiers and constraints on the write, without the "read read" 🙂) What do you think?

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


More information about the llvm-commits mailing list