[llvm] [RFC][LangRef] Specify that the accessed bytes of concurrent atomics must be either disjoint or the same (PR #204329)

Fabian Ritter via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 23:38:27 PDT 2026


================
@@ -3968,13 +3968,20 @@ Given that definition, R\ :sub:`byte` is defined as follows:
    R\ :sub:`byte`, R\ :sub:`byte` returns ``undef`` for that byte.
 -  Otherwise, if R\ :sub:`byte` may see exactly one write,
    R\ :sub:`byte` returns the value written by that write.
--  Otherwise, if R is atomic, and all the writes R\ :sub:`byte` may
-   see are atomic, it chooses one of the values written. See the :ref:`Atomic
+-  Otherwise, if R is atomic, all the writes R\ :sub:`byte` may
+   see are atomic, and R and the writes all access the exact same set of
+   bytes, it chooses one of the values written. See the :ref:`Atomic
----------------
ritter-x2a wrote:

Yes, that's covered, but I can absolutely understand the confusion, the LLVM memory model handles this case very indirectly:
- Either, there is another write that does happen-before the read and that the read may see (possibly the initializer for initialized globals): in that case this bullet point applies.
- Otherwise, there is no write that happens-before the read, so the second bullet point ("Otherwise, if there is no write to the same byte that happens before Rbyte, Rbyte returns undef for that byte.") says that it returns undef.

 

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


More information about the llvm-commits mailing list