[PATCH] D127233: [CodeGen] Sort llvm.global_ctors by lexical order before emission
Reid Kleckner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 15 13:11:35 PDT 2022
rnk added subscribers: ayzhao, usaxena95, ilya-biryukov.
rnk added a comment.
I think this is a straightforward improvement. I would like to see it land. Do the other reviewers have any outstanding concerns?
+cc other clang people @ayzhao @ilya-biryukov @usaxena95
================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:544
}
+ llvm::stable_sort(GlobalCtors, [](const Structor &L, const Structor &R) {
+ return L.LexOrder < R.LexOrder;
----------------
Please move this sorting into EmitCtorList and apply it to destructors. I believe they are currently emitted in source order, and the loader executes them in reverse order, so we get the desired reverse source order cleanup behavior.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127233/new/
https://reviews.llvm.org/D127233
More information about the cfe-commits
mailing list