[llvm] r326395 - [DWARF] Emit a split line table only if there are split type units.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 5 10:58:43 PST 2018


Any chance of testing if the line table is empty instead? (I doubt it makes
a difference here - but imagine if we just had one artificial type, which
isn't defined in any source file & so doesn't create any file names or
directory names in the line table section, etc)

On Wed, Feb 28, 2018 at 4:14 PM Paul Robinson via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: probinson
> Date: Wed Feb 28 16:12:35 2018
> New Revision: 326395
>
> URL: http://llvm.org/viewvc/llvm-project?rev=326395&view=rev
> Log:
> [DWARF] Emit a split line table only if there are split type units.
>
> A .debug_info.dwo section doesn't use the .debug_line.dwo section.
>
> Modified:
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
>     llvm/trunk/test/DebugInfo/Generic/empty.ll
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=326395&r1=326394&r2=326395&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Feb 28 16:12:35
> 2018
> @@ -2105,6 +2105,8 @@ void DwarfDebug::emitDebugAbbrevDWO() {
>
>  void DwarfDebug::emitDebugLineDWO() {
>    assert(useSplitDwarf() && "No split dwarf?");
> +  if (!HasSplitTypeUnits)
> +    return;
>    Asm->OutStreamer->SwitchSection(
>        Asm->getObjFileLowering().getDwarfLineDWOSection());
>    SplitTypeUnitFileTable.Emit(*Asm->OutStreamer,
> MCDwarfLineTableParams());
> @@ -2220,6 +2222,7 @@ void DwarfDebug::addDwarfTypeUnitType(Dw
>        InfoHolder.computeSizeAndOffsetsForUnit(TU.first.get());
>        InfoHolder.emitUnit(TU.first.get(), useSplitDwarf());
>      }
> +    HasSplitTypeUnits = useSplitDwarf();
>    }
>    CU.addDIETypeSignature(RefDie, Signature);
>  }
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=326395&r1=326394&r2=326395&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Feb 28 16:12:35 2018
> @@ -274,6 +274,10 @@ class DwarfDebug : public DebugHandlerBa
>    /// a monolithic sequence of string offsets.
>    bool UseSegmentedStringOffsetsTable;
>
> +  /// Whether we have emitted any type units with split DWARF (and
> therefore
> +  /// need to emit a line table to the .dwo file).
> +  bool HasSplitTypeUnits = false;
> +
>    /// Separated Dwarf Variables
>    /// In general these will all be for bits that are left in the
>    /// original object file, rather than things that are meant
>
> Modified: llvm/trunk/test/DebugInfo/Generic/empty.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Generic/empty.ll?rev=326395&r1=326394&r2=326395&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/Generic/empty.ll (original)
> +++ llvm/trunk/test/DebugInfo/Generic/empty.ll Wed Feb 28 16:12:35 2018
> @@ -16,7 +16,9 @@
>  ; CHECK: contents:
>
>  ; Don't emit DW_AT_addr_base when there are no addresses.
> +; Also don't emit a split line table when there are no type units.
>  ; FISSION-NOT: DW_AT_GNU_addr_base [DW_FORM_sec_offset]
> +; FISSION-NOT: .debug_line.dwo contents:
>
>  !llvm.dbg.cu = !{!0}
>  !llvm.module.flags = !{!5}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180305/d517c09d/attachment.html>


More information about the llvm-commits mailing list