[llvm] [LLVM][DWARF] Add support for monolithic types in .debug_names (PR #68131)

Alexander Yermolovich via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 5 17:10:50 PDT 2023


================
@@ -3514,11 +3520,15 @@ void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
       return;
     }
 
-    // If the type wasn't dependent on fission addresses, finish adding the type
-    // and all its dependent types.
     for (auto &TU : TypeUnitsToAdd) {
       InfoHolder.computeSizeAndOffsetsForUnit(TU.first.get());
       InfoHolder.emitUnit(TU.first.get(), useSplitDwarf());
+      if (getDwarfVersion() >= 5 &&
+          getAccelTableKind() == AccelTableKind::Dwarf) {
+        addTypeUnit(std::move(TU.first));
----------------
ayermolo wrote:

> > I have not. Were you thinking for one invocation of clang, or to build whole project?
> > What do you think a reasonable number of type units pre compilation modules are?
> 
> Given I expect this to be a fairly clear non-starter, I'd probably test something pretty simple like, say, Clang's Sema.cpp - it's a bit of a big/rough thing to compile, probably has enough types to show up a significant regression I'd expect would be caused by keeping all the TUs alive to the end of the compilation.

Generated response file from command in compile_commands.json for Debug Build and used release build of clang to compile Sema.cpp
In the resulting object file there are 22124 .debug_info sections, so 22123 Type Units.

alias time="$(which time) -f '\t%E real,\t%U user,\t%S sys,\t%K amem,\t%M mmem'"
time ~/local/llvm-build-upstream-release/bin/clang++ @response.txt

with changes .debug_names generated
0:15.85 real,   15.41 user,     0.42 sys,       0 amem, 658136 mmem
0:15.15 real,   14.74 user,     0.39 sys,       0 amem, 658460 mmem
0:15.46 real,   15.05 user,     0.39 sys,       0 amem, 658444 mmem

without changes current default behavior .debug_names not generated

0:15.94 real,   15.52 user,     0.41 sys,       0 amem, 658792 mmem
0:15.25 real,   14.81 user,     0.43 sys,       0 amem, 658452 mmem
0:15.58 real,   15.11 user,     0.46 sys,       0 amem, 658592 mmem

Is this what you were looking for?

https://github.com/llvm/llvm-project/pull/68131


More information about the llvm-commits mailing list