<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 25, 2016, at 6:03 PM, Duncan Exon Smith <<a href="mailto:dexonsmith@apple.com" class="">dexonsmith@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class=""><br class=""></div><div class=""><br class="">On Mar 25, 2016, at 5:53 PM, Adrian Prantl <<a href="mailto:aprantl@apple.com" class="">aprantl@apple.com</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Mar 25, 2016, at 5:48 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Mar 25, 2016 at 5:44 PM, Adrian Prantl <span dir="ltr" class=""><<a href="mailto:aprantl@apple.com" target="_blank" class="">aprantl@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br class="">
> On Mar 25, 2016, at 12:41 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:<br class="">
><br class="">
><br class="">
><br class="">
> On Fri, Mar 25, 2016 at 12:33 PM, Adrian Prantl via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>> wrote:<br class="">
>> aprantl added a comment.<br class="">
>><br class="">
>> Digging further through the commit (and radar) history this feature has been added to support dtrace.<br class="">
>> Instead of having everyone pay for this, I think it would be a more appropriate resolution for this to add something like a -gfull option to clang that retains every type in the compile unit.<br class="">
><br class="">
> Possibly - but is that what dtrace needs? It'll be a /lot/ of debug info... but yeah, having some filtering flags (with the default being what you are going for in this patch - if it's referenced by live code, we include it (types, subprograms, etc)).<br class="">
<br class="">
</span>Looking at the clang sources I noticed that the clang driver already accepts a -gfull option for gcc compatibility; it translates to -fno-eliminate-unused-debug-symbols and is ignored by cc1.<br class="">
<br class="">
I think it would make sense to pass this option through to LLVM and move the collectDeadVariables logic from the DwarfUnit.cpp into GlobalDCE.cpp where dead functions are being deleted. When -fno-eliminate-unused-debug-symbols is present, GlobalDCE can insert the types of all local variables attached to the dead Function’s DISubprogram to the DICompileUnit’s set of retained types, thus preserving the spirit of r107027.<br class=""></blockquote><div class=""><br class="">Why not just put all the types in the retained types list to begin with? (size could be a factor, but would be interesting to know before having to make sure they're preserved through various optimizations)</div></div></div></div></div></blockquote><br class=""></div><div class="">I’ll definitely do some benchmarking, but the main problem I see is that we then emit debug info for every type defined in a header file regardless of whether it is used or not. Since the dtrace ctfconvert utility is run on the kernel, which is mostly written in C, there is no type uniquing possible and I’m worried about the amount of debug info this generates.</div><div class=""><br class=""></div><div class="">-- adrian</div></div></blockquote><br class=""><div class="">I wouldn't do all types.  Just the ones referenced by local variables in functions that IRGen emits.  The same set that collectDeadVariables would hold onto. </div></div></div></blockquote><br class=""></div><div>... which is simply the set of all types that we’re actually creating in CGDebugInfo. DwarfDebug is already smart enough create each type only once so there’s no need to worry about having a type retained and referenced elsewhere. Good point.</div><div><br class=""></div><div>-- adrian</div><br class=""></body></html>