<div dir="ltr"><div>Since this aside got a life of its own - changing the subject to reflect that.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 15, 2021 at 12:47 PM <<a href="mailto:paul.robinson@sony.com">paul.robinson@sony.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="EN-US" style="overflow-wrap: break-word;">
<div class="gmail-m_7180338005463013387WordSection1">
<p class="MsoNormal">My recollection is that type units can end up being used for types that actually don’t take up a lot of space, and so the overhead of the type units ends up costing extra.  I put a task on our internal tracker to look into this properly,
 but we wouldn’t mind if someone else had a run at it (if only to prove that my recollection is incorrect).<u></u><u></u></p>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
<p class="MsoNormal">--paulr<u></u><u></u></p>
<p class="MsoNormal">who is on vacation and really shouldn’t be looking at these emails<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt">
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>> <b>On Behalf Of
</b>Reid Kleckner via llvm-dev<br>
<b>Sent:</b> Friday, October 15, 2021 3:26 PM<br>
<b>To:</b> David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>><br>
<b>Cc:</b> llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br>
<b>Subject:</b> Re: [llvm-dev] distinct DISubprograms hindering sharing inlined subprogram descriptions<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">Sorry for derailing into your aside, but...<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">On Fri, Oct 15, 2021 at 12:07 PM David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<u></u><u></u></p>
</div>
<div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal">(side note: Anyone interested in making ThinLTO home type definitions? That'd be great to reduce type duplication - would mean ThinLTO could turn off type units and/or that .o/.dwo/etc files would just generally be smaller anyway)<u></u><u></u></p>
</div>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Hey, I think that is a great idea! ThinLTO tends to be used in release build configurations, which tend to have debug info enabled. The size of symbols in release build config matters a lot because it is typically archived for a long time.</p></div></div></div></div></div></div></blockquote><div><br></div><div>Yeah, I had some vague idea (I forget whether I've implemented parts of it) to have the frontend make smart decisions about whether to put a linkage name on a type (used for deduplicating during IR linking, and also used as the key for DWARF type units) if it knew the type was being emitted only once (eg: if it had a strong vtable - no need to use a type unit).<br><br>That'd have some wins straight away for situations like strong vtables (or I guess we could do something similar with ctor homing - if the type only has one ctor and it has strong linkage, and explicit template specializations... maybe you can technically have more than one of those? Ah well) - and then if we taught ThinLTO to remove the linkage name from a type and "promote" it to a singular definition, stripping it out from other modules - it could benefit there too.<br><br>I mean, we'd probably just end up turning off type units entirely under ThinLTO because it'd be "perfect" (hmm, only if it's whole program/you're not deduplicating types with objects outside the ThinLTO scope... ) - so the "opting out of type units on a per-type basis" part of this probably isn't necessary but a nice way to express things anyway, maybe.</div><div>  </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US" style="overflow-wrap: break-word;"><div class="gmail-m_7180338005463013387WordSection1"><div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt"><div><p class="MsoNormal"><u></u></p>
</div>
<div>
<p class="MsoNormal">COFF & MachO platforms have other ways to deduplicate types (PDBs & dsymutil), but less duplicate stuff always makes things faster.</p></div></div></div></div></blockquote><div><br></div><div>Yep yep.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US" style="overflow-wrap: break-word;"><div class="gmail-m_7180338005463013387WordSection1"><div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt">
<div>
<div>
<p class="MsoNormal">For ELF users already using type units, this optimization will only allow us to recover the overhead of type units, which I recall is significant. In our evaluation of the feature for Chrome, we found it increased the final binary size
 significantly: <a href="https://urldefense.com/v3/__http:/crbug.com/1031936*c4__;Iw!!JmoZiZGBv3RvKRSx!qg0PDEAWoBKjGth7hk524aPYTrQqB8FrCOws1hiil6XaLGH_lFZRG8n7oW4wMKqPkA$" target="_blank">
crbug.com/1031936#c4</a></p></div></div></div></div></div></blockquote><div><br></div><div>Yep, the overhead is significant (hmm - you'd only see an increase in the final binary size if there were very few duplicates - perhaps after ctor homing that was the case that there was so little duplication that the advantages of deduplicating were outweighed by the overhead of type units)</div><div> </div></div></div>