<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hm.  Actually seems quite feasible.  I'll have a go at that next.  The DwarfTypeUnit instances don't survive after they've been emitted, right?  so the extra
 bit isn't that big a deal.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr<o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></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:dblaikie@gmail.com]
<br>
<b>Sent:</b> Monday, March 05, 2018 3:15 PM<br>
<b>To:</b> Robinson, Paul<br>
<b>Cc:</b> llvm-commits@lists.llvm.org<br>
<b>Subject:</b> Re: [llvm] r326395 - [DWARF] Emit a split line table only if there are split type units.<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">On Mon, Mar 5, 2018 at 1:34 PM <<a href="mailto:paul.robinson@sony.com" target="_blank">paul.robinson@sony.com</a>> wrote:<o:p></o:p></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">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><a name="m_7111107885754656850_m_-466083016298449"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span></a><o:p></o:p></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" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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.</span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">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)<o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">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:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">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><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</body>
</html>