From: Eli Friedman Date: Fri, 22 Jul 2011 03:04:45 +0000 (+0000) Subject: Some LangRef tweaks, per Dan's comments. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=118973a2c55452aa1242b11a529ca3f36586e3fb Some LangRef tweaks, per Dan's comments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135744 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/LangRef.html b/docs/LangRef.html index 07720e51f24..225173e3d30 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -1500,18 +1500,19 @@ between a thread and signals executing inside that thread.

Every (defined) read operation (load instructions, memcpy, atomic loads/read-modify-writes, etc.) R reads a series of bytes written by (defined) write operations (store instructions, atomic -stores/read-modify-writes, memcpy, etc.). For each byte, R reads the -value written by some write that it may see, given any relevant -happens-before constraints. Rbyte may -see any write to the same byte, except:

+stores/read-modify-writes, memcpy, etc.). For the purposes of this section, +initialized globals are considered to have a write of the initializer which is +atomic and happens before any other read or write of the memory in question. +For each byte of a read R, Rbyte may see +any write to the same byte, except:

@@ -1520,14 +1521,13 @@ see any write to the same byte, except:

  • If there is no write to the same byte that happens before Rbyte, Rbyte returns undef for that byte. -
  • If Rbyte may see exactly one write, +
  • Otherwise, if Rbyte may see exactly one write, Rbyte returns the value written by that write.
  • -
  • If Rbyte and all the writes it may see are - atomic, it chooses one of those writes and returns it value. - Given any two bytes in a given read R, if the set of - writes Rbyte may see is the same as the set - of writes another byte may see, they will both choose the same write. +
  • Otherwise, if R is atomic, and all the writes + Rbyte may see are atomic, it chooses one of the + values written. See the Atomic intrinsics + section for additional guarantees on how the choice is made.
  • Otherwise Rbyte returns undef.
  • @@ -1540,7 +1540,10 @@ emit more than one instruction to read the series of bytes.

    Note that in cases where none of the atomic intrinsics are used, this model places only one restriction on IR transformations on top of what is required for single-threaded execution: introducing a store to a byte which might not -otherwise be stored to can introduce undefined behavior.

    +otherwise be stored to can introduce undefined behavior. (Specifically, in +the case where another thread might write to and read from an address, +introducing a store can change a load that may see exactly one write into +a load that may see multiple writes.)