[PATCH] D103495: [static initializers] Don't put ordered dynamic initializers of static variables into global_ctors

Yuanfang Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 2 14:18:06 PDT 2021


ychen added a comment.

> The LLVM IR langref says that llvm.global_ctors are called in ascending priority order, and the order between initializers is not defined. That's not very helpful and often doesn't reflect reality. I wonder if we could do two things, perhaps separately:
>
> 1. emit llvm.global_ctors so that they are called in order of appearance in the IR array (is this not already true?)
> 2. define the order of initialization in LangRef

Is there anything preventing us from using the existing priority field to define the order instead of introducing the order among initializers with the same priority? If we go with 1., there would be no way to say that "the order does not matter" right?


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

https://reviews.llvm.org/D103495



More information about the cfe-commits mailing list