[llvm-dev] Meaning of loads/stores marked both atomic and volatile

Reid Kleckner via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 20 13:31:48 PST 2017


On Mon, Nov 20, 2017 at 1:22 PM, PaweĊ‚ Batko <pawel.batko at gmail.com> wrote:

> Hi Reid,
>
> On 20 November 2017 at 21:44, Reid Kleckner <rnk at google.com> wrote:
> > For example, llvm should be able to mem2reg
> > unescaped atomics because it knows they cannot be modified by other
> threads,
>
> Could you point to some resources that explain what an unescaped atomic is?
>

I mean a local variable that is _Atomic qualified whose address does not
escape the function that allocates it. An unused _Atomic int, for example,
can be removed. If it were volatile, the storage and any loads and stores
would have to be preserved.

In other words, atomics come with a threading model, semantics, and rules
that permit certain transformations. Volatile still acts as an escape hatch
to throw that out the window.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171120/03094fd8/attachment.html>


More information about the llvm-dev mailing list