[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
Tue Jun 30 02:48:35 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:

> It currently all sounds quite operational.

But not the memory model. Sentences like "there is a single total order for modifications by monotonic operations on each address." sound quite axiomatic to me. Also the whole definition of fences only doing anything if they pair with other operations that might happen at completely different points in the program isn't very operational either. With a lot of squinting, the "This model is inspired by the C++ memory model." sentence could also be interpreted as implying an axiomatic approach...

Just to be clear, do you say that this change here about partially overlapping accesses makes the spec less operational, or are you saying that, generally, the memory model as it is doesn't fit with the rest of the LLVM IR semantics (or what we know of it)?

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


More information about the llvm-commits mailing list