[PATCH] D109554: [DebugInfo] Emit DW_AT_inline under -g1/-gmlt

Zequan Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 9 18:41:51 PDT 2021


zequanwu added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:1108-1113
+  if (DD->getDwarfVersion() <= 4)
+    ContextCU->addUInt(*AbsDef, dwarf::DW_AT_inline, None,
+                       dwarf::DW_INL_inlined);
+  else
+    ContextCU->addSInt(*AbsDef, dwarf::DW_AT_inline,
+                       dwarf::DW_FORM_implicit_const, dwarf::DW_INL_inlined);
----------------
dblaikie wrote:
> 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?
Changed to one addSInt, as addUInt doesn't allow dwarf::DW_FORM_implicit_const.


================
Comment at: llvm/test/DebugInfo/Inputs/gmlt.ll:37-41
 ; FIXME: Emitting separate abstract definitions is inefficient when we could
 ; just attach the DW_AT_name to the inlined_subroutine directly. Except that
 ; would produce many string relocations. Implement string indexing in the
 ; skeleton CU to address the relocation problem, then remove abstract
 ; definitions from -gmlt here.
----------------
dblaikie wrote:
> This comment points to an alternate direction at least for DWARFv5 - if that's of interest.
Yeah, looks like could save some spaces by replacing all DW_AT_abstract_origin with a string index.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109554



More information about the llvm-commits mailing list