[PATCH] D129841: [GlobalOpt] Enable evaluation of atomic stores

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 20 00:19:47 PDT 2022


dvyukov added a comment.

In D129841#3661770 <https://reviews.llvm.org/D129841#3661770>, @alexander-shaposhnikov wrote:

> Currently Clang does the following: (not fully observable on godbolt but one can build the actual binary and take a look at the global constructors)
> 1/ https://godbolt.org/z/cqErE8bcj  (invocation of the global constructor is replaced with static initialization  .word   5)
> 2/ https://godbolt.org/z/3cfxc41na (not the case for atomic<int>) 
> With this diff (2) will start to behave like (1).
>
> P.S. Worth noting that https://godbolt.org/z/WKqh7TvbW (line 79: .word 5) (but this is happening due to Clang's frontend, not LLVM's optimizer)

This sounds reasonable and good to me.

But why does atomic ctor results in an atomic store at all? Shouldn't it be non-atomic in the first place?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129841/new/

https://reviews.llvm.org/D129841



More information about the llvm-commits mailing list