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

Ellis Hoag via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 20 18:41:01 PDT 2021


ellis added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h:100
+  };
+  SmallVector<UnfinishedStaticVariable, 1> UnfinishedStaticVariables;
+
----------------
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.


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