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

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 20 01:25:02 PDT 2022


dvyukov added a comment.

So this is not about std::atomic ctors, then this is more interesting.

If I am reading things correctly, clang seems to be broken now on the following code:
https://godbolt.org/z/x71rb9P79
(returns 5 when must always return 10).

Won't this optimization break atomics in the same way?
For atomics things become even more intersting... what if some ctors have already started threads that are reading these global vars?... generally it's not possible to observe all concurrent values, so it may be fine, but I am not 100% sure.


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