1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00

[docs] Clarify where the indirect UB due to write-write races comes from

This is based on https://bugs.llvm.org/show_bug.cgi?id=42435#c3.

Patch by Ralf Jung.

llvm-svn: 366855
This commit is contained in:
Eli Friedman 2019-07-23 21:51:26 +00:00
parent 2bb3cae6fc
commit fd778f3433

View File

@ -87,8 +87,10 @@ The following is equivalent in non-concurrent situations:
However, LLVM is not allowed to transform the former to the latter: it could
indirectly introduce undefined behavior if another thread can access ``x`` at
the same time. (This example is particularly of interest because before the
concurrency model was implemented, LLVM would perform this transformation.)
the same time. That thread would read `undef` instead of the value it was
expecting, which can lead to undefined behavior down the line. (This example is
particularly of interest because before the concurrency model was implemented,
LLVM would perform this transformation.)
Note that speculative loads are allowed; a load which is part of a race returns
``undef``, but does not have undefined behavior.