rnk added inline comments.
================ Comment at: clang/lib/CodeGen/CGDeclCXX.cpp:563 + } else if (IsInstantiation || getContext().GetGVALinkageForVariable(D) == GVA_DiscardableODR || D->hasAttr<SelectAnyAttr>()) { ---------------- @rsmith , if inline global variable initialization has ordering requirements, we have a bug, because I believe this GVA_DiscardableODR codepath handles them, and we come through here to give them separate initializers in llvm.global_ctors. See the example with two separate global_ctors entries on godbolt: https://gcc.godbolt.org/z/5d577snqb As long as LLVM doesn't provide ordering guarantees about same priority initializers in global_ctors, inline globals have the same problems as template instantiations. IMO whatever solution we use to order inline globals should be used for template instantiations. Intuitively, that means LLVM should promise to run global_ctors in left-to-right order, and if all TUs instantiate initializers in the same order, everything should behave intuitively. The question then becomes, why doesn't this work already? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126341/new/ https://reviews.llvm.org/D126341 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits