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

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


dvyukov added a comment.

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

> 

Interesting.

I've read this as talking about the cases when we have both C++ objects and attribute constructor in the same TU (the order between these groups is unspecified unless init_priority is used):

> If I am not mistaken attribute((constructor)) is an extension and I have only found the following bit of documentation: https://gcc.gnu.org/onlinedocs/gcc-11.2.0/gcc/Common-Function-Attributes.html#index-constructor-function-attribute
> "However, at present, the order in which constructors for C++ objects with static storage duration and functions decorated with attribute constructor are invoked is unspecified. In mixed declarations, attribute init_priority can be used to impose a specific ordering."

But then it means docs don't say anything about order of  attribute constructor w/o priority at all.

If we assume that order is unspecified and this optimization affects only attribute constructor, then I think it's safe even in presence of threads (as if all statically evaluated ctors run first).


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