<div dir="ltr">I'd be interested in numbers from, say, a clang (or other large/common C++ code) self-host with and without these changes (also, might be worth looking at the change as a % of debug info), especially in unoptimized (& possibly asan) builds where the extra-terse LLVM gmlt is most valuable.<br><br>I suspect we may end up wanting this behind a flag for profile users - it seems extra cost for sanitizers, for example (which is where LLVM's gmlt has been targeted until now) to pay.<br><br>- Dave</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 10, 2016 at 8:35 AM Dehao Chen <<a href="mailto:danielcdh@gmail.com">danielcdh@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">danielcdh created this revision.<br class="gmail_msg">
danielcdh added reviewers: dblaikie, echristo, davidxl.<br class="gmail_msg">
danielcdh added a subscriber: llvm-commits.<br class="gmail_msg">
Herald added a subscriber: mehdi_amini.<br class="gmail_msg">
<br class="gmail_msg">
SamplePGO binaries built with -gmlt to collect profile. The current -gmlt debug info is limited, and we need some additional info:<br class="gmail_msg">
<br class="gmail_msg">
- start line of all subprograms<br class="gmail_msg">
- linkage name of all subprograms<br class="gmail_msg">
- standalone subprograms (functions that has neither inlined nor been inlined)<br class="gmail_msg">
<br class="gmail_msg">
This patch adds these information to the -gmlt binary. The impact on speccpu2006 binary size (size increase comparing with -g0 binary, also includes data for -g binary, which does not change with this patch):<br class="gmail_msg">
<br class="gmail_msg">
-gmlt(orig) -gmlt(patched) -g<br class="gmail_msg">
<br class="gmail_msg">
433.milc 4.68% 5.40% 19.73%<br class="gmail_msg">
444.namd 8.45% 8.93% 45.99%<br class="gmail_msg">
447.dealII 97.43% 115.21% 374.89%<br class="gmail_msg">
450.soplex 27.75% 31.88% 126.04%<br class="gmail_msg">
453.povray 21.81% 26.16% 92.03%<br class="gmail_msg">
470.lbm 0.60% 0.67% 1.96%<br class="gmail_msg">
482.sphinx3 5.77% 6.47% 26.17%<br class="gmail_msg">
400.perlbench 17.81% 19.43% 73.08%<br class="gmail_msg">
401.bzip2 3.73% 3.92% 12.18%<br class="gmail_msg">
403.gcc 31.75% 34.48% 122.75%<br class="gmail_msg">
429.mcf 0.78% 0.88% 3.89%<br class="gmail_msg">
445.gobmk 6.08% 7.92% 42.27%<br class="gmail_msg">
456.hmmer 10.36% 11.25% 35.23%<br class="gmail_msg">
458.sjeng 5.08% 5.42% 14.36%<br class="gmail_msg">
462.libquantum 1.71% 1.96% 6.36%<br class="gmail_msg">
464.h264ref 15.61% 16.56% 43.92%<br class="gmail_msg">
471.omnetpp 11.93% 15.84% 60.09%<br class="gmail_msg">
473.astar 3.11% 3.69% 14.18%<br class="gmail_msg">
483.xalancbmk 56.29% 81.63% 353.22%<br class="gmail_msg">
geomean 15.60% 18.30% 57.81%<br class="gmail_msg">
<br class="gmail_msg">
Debug info size change for -gmlt binary with this patch:<br class="gmail_msg">
<br class="gmail_msg">
433.milc 13.46%<br class="gmail_msg">
444.namd 5.35%<br class="gmail_msg">
447.dealII 18.21%<br class="gmail_msg">
450.soplex 14.68%<br class="gmail_msg">
453.povray 19.65%<br class="gmail_msg">
470.lbm 6.03%<br class="gmail_msg">
482.sphinx3 11.21%<br class="gmail_msg">
400.perlbench 8.91%<br class="gmail_msg">
401.bzip2 4.41%<br class="gmail_msg">
403.gcc 8.56%<br class="gmail_msg">
429.mcf 8.24%<br class="gmail_msg">
445.gobmk 29.47%<br class="gmail_msg">
456.hmmer 8.19%<br class="gmail_msg">
458.sjeng 6.05%<br class="gmail_msg">
462.libquantum 11.23%<br class="gmail_msg">
464.h264ref 5.93%<br class="gmail_msg">
471.omnetpp 31.89%<br class="gmail_msg">
473.astar 16.20%<br class="gmail_msg">
483.xalancbmk 44.62%<br class="gmail_msg">
geomean 16.83%<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<a href="https://reviews.llvm.org/D25434" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D25434</a><br class="gmail_msg">
<br class="gmail_msg">
Files:<br class="gmail_msg">
lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br class="gmail_msg">
lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Index: lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br class="gmail_msg">
===================================================================<br class="gmail_msg">
--- lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br class="gmail_msg">
+++ lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br class="gmail_msg">
@@ -1176,20 +1176,19 @@<br class="gmail_msg">
<br class="gmail_msg">
void DwarfUnit::applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie,<br class="gmail_msg">
bool Minimal) {<br class="gmail_msg">
- if (!Minimal)<br class="gmail_msg">
- if (applySubprogramDefinitionAttributes(SP, SPDie))<br class="gmail_msg">
- return;<br class="gmail_msg">
+ if (applySubprogramDefinitionAttributes(SP, SPDie))<br class="gmail_msg">
+ return;<br class="gmail_msg">
<br class="gmail_msg">
// Constructors and operators for anonymous aggregates do not have names.<br class="gmail_msg">
if (!SP->getName().empty())<br class="gmail_msg">
addString(SPDie, dwarf::DW_AT_name, SP->getName());<br class="gmail_msg">
<br class="gmail_msg">
+ addSourceLine(SPDie, SP);<br class="gmail_msg">
+<br class="gmail_msg">
// Skip the rest of the attributes under -gmlt to save space.<br class="gmail_msg">
if (Minimal)<br class="gmail_msg">
return;<br class="gmail_msg">
<br class="gmail_msg">
- addSourceLine(SPDie, SP);<br class="gmail_msg">
-<br class="gmail_msg">
// Add the prototype if we have a prototype and we have a C like<br class="gmail_msg">
// language.<br class="gmail_msg">
uint16_t Language = getLanguage();<br class="gmail_msg">
Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br class="gmail_msg">
===================================================================<br class="gmail_msg">
--- lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br class="gmail_msg">
+++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br class="gmail_msg">
@@ -1128,21 +1128,6 @@<br class="gmail_msg">
// Add the range of this function to the list of ranges for the CU.<br class="gmail_msg">
TheCU.addRange(RangeSpan(Asm->getFunctionBegin(), Asm->getFunctionEnd()));<br class="gmail_msg">
<br class="gmail_msg">
- // Under -gmlt, skip building the subprogram if there are no inlined<br class="gmail_msg">
- // subroutines inside it.<br class="gmail_msg">
- if (TheCU.getCUNode()->getEmissionKind() == DICompileUnit::LineTablesOnly &&<br class="gmail_msg">
- LScopes.getAbstractScopesList().empty() && !IsDarwin) {<br class="gmail_msg">
- assert(InfoHolder.getScopeVariables().empty());<br class="gmail_msg">
- assert(DbgValues.empty());<br class="gmail_msg">
- // FIXME: This wouldn't be true in LTO with a -g (with inlining) CU followed<br class="gmail_msg">
- // by a -gmlt CU. Add a test and remove this assertion.<br class="gmail_msg">
- assert(AbstractVariables.empty());<br class="gmail_msg">
- PrevLabel = nullptr;<br class="gmail_msg">
- CurFn = nullptr;<br class="gmail_msg">
- DebugHandlerBase::endFunction(MF);<br class="gmail_msg">
- return;<br class="gmail_msg">
- }<br class="gmail_msg">
-<br class="gmail_msg">
#ifndef NDEBUG<br class="gmail_msg">
size_t NumAbstractScopes = LScopes.getAbstractScopesList().size();<br class="gmail_msg">
#endif<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
</blockquote></div>