<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:x="urn:schemas-microsoft-com:office:excel" 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:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@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:0cm;
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:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
span.EmailStyle17
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi Chandler,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>So I have built llvm+clang+lldb which a clang with various thresholds, and here are the results (user time in seconds for a build from scratch, averaged over 5 builds). Note that the reported threshold is inclusive: 33 (the current threshold) means all object whose size >= 33 bytes will be marked for example.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=197 style='width:148.0pt;margin-left:-.75pt;border-collapse:collapse'><tr style='height:15.0pt'><td width=64 nowrap valign=bottom style='width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Threshold<o:p></o:p></span></p></td><td width=63 nowrap valign=bottom style='width:47.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Average<o:p></o:p></span></p></td><td width=71 nowrap valign=bottom style='width:53.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Variance<o:p></o:p></span></p></td></tr><tr style='height:15.0pt'><td width=64 nowrap valign=bottom style='width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>33<o:p></o:p></span></p></td><td width=63 nowrap valign=bottom style='width:47.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>4652.67<o:p></o:p></span></p></td><td width=71 nowrap valign=bottom style='width:53.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>4.51<o:p></o:p></span></p></td></tr><tr style='height:15.0pt'><td width=64 nowrap valign=bottom style='width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>32<o:p></o:p></span></p></td><td width=63 nowrap valign=bottom style='width:47.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>4677.02<o:p></o:p></span></p></td><td width=71 nowrap valign=bottom style='width:53.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>2.71<o:p></o:p></span></p></td></tr><tr style='height:15.0pt'><td width=64 nowrap valign=bottom style='width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>16<o:p></o:p></span></p></td><td width=63 nowrap valign=bottom style='width:47.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>4681.50<o:p></o:p></span></p></td><td width=71 nowrap valign=bottom style='width:53.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>11.06<o:p></o:p></span></p></td></tr><tr style='height:15.0pt'><td width=64 nowrap valign=bottom style='width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>8<o:p></o:p></span></p></td><td width=63 nowrap valign=bottom style='width:47.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>4660.23<o:p></o:p></span></p></td><td width=71 nowrap valign=bottom style='width:53.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>12.47<o:p></o:p></span></p></td></tr><tr style='height:15.0pt'><td width=64 nowrap valign=bottom style='width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>0<o:p></o:p></span></p></td><td width=63 nowrap valign=bottom style='width:47.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>4667.47<o:p></o:p></span></p></td><td width=71 nowrap valign=bottom style='width:53.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>8.63<o:p></o:p></span></p></td></tr></table><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>There are some minor fluctuation that I cannot really explain, but we just have no compromise to make there: always insert the lifetime markers </span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>J</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>When I will remove the threshold, I will send a heads-up as there may be code out there triggering interesting compile time behaviour / optimization passes not playing well with the lifetime markers (there have been some commits in that area recently).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Cheers,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>--<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Arnaud<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='margin-left:36.0pt'><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> cfe-commits-bounces@cs.uiuc.edu [mailto:cfe-commits-bounces@cs.uiuc.edu] <b>On Behalf Of </b>Arnaud A. de Grandmaison<br><b>Sent:</b> 25 September 2014 11:51<br><b>To:</b> 'Chandler Carruth'<br><b>Cc:</b> llvm cfe<br><b>Subject:</b> RE: [PATCH] Emit lifetime start/end for unnamed objects --- take 3<o:p></o:p></span></p></div></div><p class=MsoNormal style='margin-left:36.0pt'><o:p> </o:p></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:72.0pt'><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Chandler Carruth [<a href="mailto:chandlerc@google.com">mailto:chandlerc@google.com</a>] <br><b>Sent:</b> 25 September 2014 11:23<br><b>To:</b> Arnaud De Grandmaison<br><b>Cc:</b> David Blaikie; llvm cfe<br><b>Subject:</b> Re: [PATCH] Emit lifetime start/end for unnamed objects --- take 3<o:p></o:p></span></p><p class=MsoNormal style='margin-left:72.0pt'><o:p> </o:p></p><div><div><p class=MsoNormal style='margin-left:72.0pt'><o:p> </o:p></p><div><p class=MsoNormal style='margin-left:72.0pt'>On Tue, Sep 16, 2014 at 1:29 AM, Arnaud A. de Grandmaison <<a href="mailto:arnaud.degrandmaison@arm.com" target="_blank">arnaud.degrandmaison@arm.com</a>> wrote:<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>I do not know how this 32 bytes threshold has been choosen, but there is for sure a compile time / stack size gain trade-off to be made.</span><o:p></o:p></p><div><p class=MsoNormal style='margin-left:72.0pt'><o:p> </o:p></p></div><div><p class=MsoNormal style='margin-left:72.0pt'>Really? I can't understand why we want *any* threshold here. I think we should aggressively mark all temporaries with this and fix the algorithms to deal with compile time.<o:p></o:p></p></div><div><p class=MsoNormal style='margin-left:72.0pt'><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I will then bootstrap llvm+clang as a testcase, with various thresholds and no threshold so that we know if we have compile time issues or not. We can then decide of the proper follow-up: remove the threshold, or lower it to an acceptable value until some passes get fixed.<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:72.0pt'> <o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt'><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>My experiments have shown that for our customer case, the threshold should be lower: 16-bytes. But changing this threshold would require a separate thread on this list, as well as much more measurements.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>The improvements I have been able to get, by visual inspection of the generated assembly code, for a single call of the hot functions were:</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'> | GCC | Clang | LT-32 | LT-16 |</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>===+=====+=======+=======+=======+</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>F1 | 432 | 608 | 608 | 400 |</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>F2 | 432 | 640 | 640 | 432 |</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>F3 | 384 | 368 | 368 | 192 |</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>F4 | 320 | 400 | 400 | 224 |</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>Stack size is expressed in bytes.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>GCC version 4.8</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>LT-32 is clang with this patch (default 32 bytes threshold for all temporaries).</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>LT-16 is clang with this patch and a 16 bytes threshold for all temporaries.</span><o:p></o:p></p></blockquote></div><div><p class=MsoNormal style='margin-left:72.0pt'><o:p> </o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:72.0pt'>This is, quite simply, amazing. Please push this. Feel free to CC me if you get stuck, this is crazy important to get fixed.<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks Chandler !<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Arnaud<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p></div></div></div></body></html>