[PATCH] D108492: [DebugInfo] Place static variable DIEs under the correct parent

Ellis Hoag via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 21 22:15:42 PDT 2021


ellis added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:100
+  };
+  SmallVector<UnfinishedStaticVariable, 1> UnfinishedStaticVariables;
+
----------------
dblaikie wrote:
> ellis wrote:
> > dblaikie wrote:
> > > Rather than creating then deferring them - would it work if the whole creation were deferred until needed? (ie: move this loop:
> > > ```
> > >     DenseSet<DIGlobalVariable *> Processed;
> > >     for (auto *GVE : CUNode->getGlobalVariables()) {
> > >       DIGlobalVariable *GV = GVE->getVariable();
> > >       if (Processed.insert(GV).second)
> > >         CU.getOrCreateGlobalVariableDIE(GV, sortGlobalExprs(GVMap[GV]));
> > >     }
> > > ```
> > > from `beginModule` to `finalizeModuleInfo`?
> > The issue is `getOrCreateGlobalVariableDIE()` is call in `constructImportedEntityDIE()` before `finalizeModuleInfo()`. That's why I made sure to include `DIImportedEntity()` in the test case.
> & we can't move the imported entity creation to the end of the module because they're needed for lexical scopes?
Yeah I guess so. IMO it seems like it's simpler to just give a special case to static globals instead of deferring all globals, imported entities, and their dependencies.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108492



More information about the llvm-commits mailing list