[PATCH] D112337: [DebugInfo] Only create concrete DIEs of concrete functions

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 11 17:04:44 PST 2021


dblaikie added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp:1149-1153
+  // Try to reference the abstract origin if the subprogram is not concrete.
+  if (!DD->IsConcrete(SP))
+    if (auto *SPDie = DU->getAbstractSPDies().lookup(SP))
+      return SPDie;
+
----------------
ellis wrote:
> I believe the bug is here. When using the `-generate-type-units` flag we cannot share DIEs accross CUs, but SPDie could come from a different CU.
> 
> The crash happened at `DwarfDebug.cpp:addDwarfTypeUnitType()` because a DIE was created, added to the child of a DIE in another unit, then destroyed in `addDwarfTypeUnitType()` while the parent DIE still existed.
> 
> I have a patch that I think works fine on the `abseil-cpp` project, so I'll upload that soon.
We shouldn't (& yes, can't in the current architecture that creates type units and then emits them immediately and cleans up the data structure, to reduce peak memory usage) use cross-unit references to refer to contents of type units - but when type units are enabled we should still use cross-unit references between compilation units.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112337



More information about the llvm-commits mailing list