This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Emit DW_AT_inline under -g1/-gmlt
ClosedPublic

Authored by zequanwu on Sep 9 2021, 4:00 PM.

Details

Summary

This allows some tools (e.g. dump_syms) to rely on DW_AT_inline to determine if a DW_TAG_subprogram is inlined or not.

Tested for building chrome, the .debug_info size increased 1.4% under -g1 with this change with dwarf4, and only 1.5% increase in .debug_abbrev with dwarf 5.

Dwarf4 size changes:

   FILE SIZE        VM SIZE
--------------  --------------
 +1.4% +3.39Mi  [ = ]       0    .debug_info
 +1.0% +53.9Ki  [ = ]       0    .debug_abbrev
 -0.0%      -2  [ = ]       0    .debug_str
 +0.4% +3.45Mi  [ = ]       0    TOTAL

Dwarf5 size changes:

   FILE SIZE        VM SIZE
--------------  --------------
 +1.5% +86.3Ki  [ = ]       0    .debug_abbrev
 +0.0% +86.3Ki  [ = ]       0    TOTAL

Diff Detail

Event Timeline

zequanwu created this revision.Sep 9 2021, 4:00 PM
zequanwu requested review of this revision.Sep 9 2021, 4:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 9 2021, 4:00 PM
zequanwu edited the summary of this revision. (Show Details)Sep 9 2021, 4:54 PM
zequanwu added a reviewer: dblaikie.
zequanwu edited the summary of this revision. (Show Details)Sep 9 2021, 4:57 PM
dblaikie added inline comments.Sep 9 2021, 6:13 PM
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
1108–1112

Could these be collapsed down into:

ContextCU->addUInt(*AbsDef, dwarf::DW_AT_inline, (DD->getDwarfVersion() <= 4 ? std::optional<dwarf::Form>() : dwarf::DW_FORM_implicit_const), dwarf::DW_INL_inlined);

? (and/or is there a particular reason one of these is UInt and the other is SInt?

llvm/test/DebugInfo/Inputs/gmlt.ll
37–41

This comment points to an alternate direction at least for DWARFv5 - if that's of interest.

zequanwu updated this revision to Diff 371764.Sep 9 2021, 6:39 PM
zequanwu marked an inline comment as done.

Address comment.

zequanwu edited the summary of this revision. (Show Details)Sep 9 2021, 6:41 PM
zequanwu added inline comments.
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
1108–1112

Changed to one addSInt, as addUInt doesn't allow dwarf::DW_FORM_implicit_const.

llvm/test/DebugInfo/Inputs/gmlt.ll
37–41

Yeah, looks like could save some spaces by replacing all DW_AT_abstract_origin with a string index.

dblaikie accepted this revision.Sep 9 2021, 6:52 PM

Looks good, thanks!

This revision is now accepted and ready to land.Sep 9 2021, 6:52 PM
This revision was landed with ongoing or failed builds.Sep 9 2021, 7:00 PM
This revision was automatically updated to reflect the committed changes.