[PATCH] D25434: Generate more debug info in -gmlt

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 10 11:55:11 PDT 2016


I'd be interested in numbers from, say, a clang (or other large/common C++
code) self-host with and without these changes (also, might be worth
looking at the change as a % of debug info), especially in unoptimized (&
possibly asan) builds where the extra-terse LLVM gmlt is most valuable.

I suspect we may end up wanting this behind a flag for profile users - it
seems extra cost for sanitizers, for example (which is where LLVM's gmlt
has been targeted until now) to pay.

- Dave

On Mon, Oct 10, 2016 at 8:35 AM Dehao Chen <danielcdh at gmail.com> wrote:

> danielcdh created this revision.
> danielcdh added reviewers: dblaikie, echristo, davidxl.
> danielcdh added a subscriber: llvm-commits.
> Herald added a subscriber: mehdi_amini.
>
> SamplePGO binaries built with -gmlt to collect profile. The current -gmlt
> debug info is limited, and we need some additional info:
>
> - start line of all subprograms
> - linkage name of all subprograms
> - standalone subprograms (functions that has neither inlined nor been
> inlined)
>
> This patch adds these information to the -gmlt binary. The impact on
> speccpu2006 binary size (size increase comparing with -g0 binary, also
> includes data for -g binary, which does not change with this patch):
>
>   -gmlt(orig) -gmlt(patched) -g
>
> 433.milc       4.68%       5.40%          19.73%
> 444.namd       8.45%       8.93%          45.99%
> 447.dealII     97.43%      115.21%        374.89%
> 450.soplex     27.75%      31.88%         126.04%
> 453.povray     21.81%      26.16%         92.03%
> 470.lbm        0.60%       0.67%          1.96%
> 482.sphinx3    5.77%       6.47%          26.17%
> 400.perlbench  17.81%      19.43%         73.08%
> 401.bzip2      3.73%       3.92%          12.18%
> 403.gcc        31.75%      34.48%         122.75%
> 429.mcf        0.78%       0.88%          3.89%
> 445.gobmk      6.08%       7.92%          42.27%
> 456.hmmer      10.36%      11.25%         35.23%
> 458.sjeng      5.08%       5.42%          14.36%
> 462.libquantum 1.71%       1.96%          6.36%
> 464.h264ref    15.61%      16.56%         43.92%
> 471.omnetpp    11.93%      15.84%         60.09%
> 473.astar      3.11%       3.69%          14.18%
> 483.xalancbmk  56.29%      81.63%         353.22%
> geomean        15.60%      18.30%         57.81%
>
> Debug info size change for -gmlt binary with this patch:
>
> 433.milc       13.46%
> 444.namd       5.35%
> 447.dealII     18.21%
> 450.soplex     14.68%
> 453.povray     19.65%
> 470.lbm        6.03%
> 482.sphinx3    11.21%
> 400.perlbench  8.91%
> 401.bzip2      4.41%
> 403.gcc        8.56%
> 429.mcf        8.24%
> 445.gobmk      29.47%
> 456.hmmer      8.19%
> 458.sjeng      6.05%
> 462.libquantum 11.23%
> 464.h264ref    5.93%
> 471.omnetpp    31.89%
> 473.astar      16.20%
> 483.xalancbmk  44.62%
> geomean        16.83%
>
>
> https://reviews.llvm.org/D25434
>
> Files:
>   lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>   lib/CodeGen/AsmPrinter/DwarfUnit.cpp
>
>
> Index: lib/CodeGen/AsmPrinter/DwarfUnit.cpp
> ===================================================================
> --- lib/CodeGen/AsmPrinter/DwarfUnit.cpp
> +++ lib/CodeGen/AsmPrinter/DwarfUnit.cpp
> @@ -1176,20 +1176,19 @@
>
>  void DwarfUnit::applySubprogramAttributes(const DISubprogram *SP, DIE
> &SPDie,
>                                            bool Minimal) {
> -  if (!Minimal)
> -    if (applySubprogramDefinitionAttributes(SP, SPDie))
> -      return;
> +  if (applySubprogramDefinitionAttributes(SP, SPDie))
> +    return;
>
>    // Constructors and operators for anonymous aggregates do not have
> names.
>    if (!SP->getName().empty())
>      addString(SPDie, dwarf::DW_AT_name, SP->getName());
>
> +  addSourceLine(SPDie, SP);
> +
>    // Skip the rest of the attributes under -gmlt to save space.
>    if (Minimal)
>      return;
>
> -  addSourceLine(SPDie, SP);
> -
>    // Add the prototype if we have a prototype and we have a C like
>    // language.
>    uint16_t Language = getLanguage();
> Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> ===================================================================
> --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> +++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> @@ -1128,21 +1128,6 @@
>    // Add the range of this function to the list of ranges for the CU.
>    TheCU.addRange(RangeSpan(Asm->getFunctionBegin(),
> Asm->getFunctionEnd()));
>
> -  // Under -gmlt, skip building the subprogram if there are no inlined
> -  // subroutines inside it.
> -  if (TheCU.getCUNode()->getEmissionKind() ==
> DICompileUnit::LineTablesOnly &&
> -      LScopes.getAbstractScopesList().empty() && !IsDarwin) {
> -    assert(InfoHolder.getScopeVariables().empty());
> -    assert(DbgValues.empty());
> -    // FIXME: This wouldn't be true in LTO with a -g (with inlining) CU
> followed
> -    // by a -gmlt CU. Add a test and remove this assertion.
> -    assert(AbstractVariables.empty());
> -    PrevLabel = nullptr;
> -    CurFn = nullptr;
> -    DebugHandlerBase::endFunction(MF);
> -    return;
> -  }
> -
>  #ifndef NDEBUG
>    size_t NumAbstractScopes = LScopes.getAbstractScopesList().size();
>  #endif
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161010/9e1b19eb/attachment.html>


More information about the llvm-commits mailing list