rnk added a subscriber: alexander-shaposhnikov. rnk added a comment. I'm somewhat supportive of the goal here, but I think there are still some underlying issues.
First, why should these guarantees be limited to instantiations and not inline variables? Such as: int f(); inline int gv1 = f(); inline int gv2 = gv1 + 1; // rely on previous Second, LLVM doesn't guarantee that global_ctors at the same priority execute in order. See the langref: https://llvm.org/docs/LangRef.html#the-llvm-global-ctors-global-variable So, without a guarantee from LLVM, Clang can't rely on this behavior. LLVM relies on this lack of an ordering guarantee to power globalopt. Last, what happens when the same global is implicitly instantiated in some other TU? Won't that disrupt the ordering? +@alexander-shaposhnikov, who is working on global opt changes. 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