[PATCH] D144007: [DwarfDebug] Move emission of globals from beginModule() to endModule() (6/7)
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 10 11:01:49 PST 2023
dblaikie accepted this revision.
dblaikie added a comment.
I guess this one's a bit clearer than the type one about why changing the order is important for getting local entities correctly scoped - local static is a global variable for the debug info and IR, so we need to emit the scopes before we'll know where to put the globals, etc.
================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1333-1359
+/// Sort and unique GVEs by comparing their fragment offset.
+static SmallVectorImpl<DwarfCompileUnit::GlobalExpr> &
+sortGlobalExprs(SmallVectorImpl<DwarfCompileUnit::GlobalExpr> &GVEs) {
+ llvm::sort(
+ GVEs, [](DwarfCompileUnit::GlobalExpr A, DwarfCompileUnit::GlobalExpr B) {
+ // Sort order: first null exprs, then exprs without fragment
+ // info, then sort by fragment offset in bits.
----------------
If this function remains identical, maybe save moving it around for a separate patch to reduce the size/possible changes in this patch?
(similarly, could /possibly/ refactor the globals loop into a function in one patch, move where the call is in another, then move the function around (if you like/to bring it closer to usage) in another - making it clear that moving the call site isn't changing any other behavior)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144007/new/
https://reviews.llvm.org/D144007
More information about the llvm-commits
mailing list