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