<div dir="ltr">Sure - would make sense to have the type units conditional on whether they need/use the line table too? Though I guess that'd mean having a bit in every DwarfTypeUnit to keep track of that property.<br><br>But fair enough - maybe a comment somewhere about the tradeoffs might be worthwhile, but up to you.<br><br>As for the size - mostly I'm motivated here by some vague sense of purity - not producing an empty chunk of stuff seems good. Smaller units, etc.<br><div class="gmail_quote"><div dir="ltr">On Mon, Mar 5, 2018 at 1:34 PM <<a href="mailto:paul.robinson@sony.com" target="_blank">paul.robinson@sony.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div class="m_7111107885754656850m_-4660830162984491870WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I considered that, but the type unit would then have a dangling reference to a non-existent line table, which presumably would end up being a reference to some
 other unit's table (in a .dwp for example).  That could be confusing.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The space occupied by a split line table header with no file entries isn't that much, IMO.  Note the split line table does not have the number-of-operands list
 either.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">--paulr
<u></u><u></u></span></p>
<p class="MsoNormal"><a name="m_7111107885754656850_m_-4660830162984491870__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></a></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> David Blaikie [mailto:<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>]
<br>
<b>Sent:</b> Monday, March 05, 2018 10:59 AM<br>
<b>To:</b> Robinson, Paul<br>
<b>Cc:</b> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm] r326395 - [DWARF] Emit a split line table only if there are split type units.<u></u><u></u></span></p>
</div>
</div></div></div></div><div lang="EN-US" link="blue" vlink="purple"><div class="m_7111107885754656850m_-4660830162984491870WordSection1"><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">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)<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Wed, Feb 28, 2018 at 4:14 PM Paul Robinson via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">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" 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" 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" 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" 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" 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" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><u></u><u></u></p>
</blockquote>
</div>
</div></div></div></blockquote></div></div>