<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 12 (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;}
@font-face
        {font-family:Menlo;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* 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.apple-converted-space
        {mso-style-name:apple-converted-space;}
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'>Anna, sorry, now I see what you mean (I needed to pass --fblocks on the command line).<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'>The following simple patch fixes the performance in this case, as well as brings the implementation in line with the comment just above it (dequeue rather than unstack).<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:"Courier New";color:#1F497D'>Index: lib/Analysis/DataflowWorklist.cpp<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>===================================================================<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>--- lib/Analysis/DataflowWorklist.cpp (revision 218295)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>+++ lib/Analysis/DataflowWorklist.cpp (working copy)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>@@ -58,8 +101,10 @@<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>   // First dequeue from the worklist.  This can represent<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>   // updates along backedges that we want propagated as quickly as possible.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>-  if (!worklist.empty())<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>-    B = worklist.pop_back_val();<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>+  if (!worklist.empty()) {<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>+     B = worklist.front();<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>+     worklist.erase(worklist.begin());<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>+  }<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>   // Next dequeue from the initial graph traversal (either post order or<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>   // reverse post order).  This is the theoretical ideal in the presence<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'>The two patches are independent one from the other.<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'><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><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"'> Anna Zaks [mailto:ganna@apple.com] <br><b>Sent:</b> 03 October 2014 19:56<br><b>To:</b> Artyom Skrobov<br><b>Cc:</b> Alexander Kornienko; Ted Kremenek; cfe-commits@cs.uiuc.edu<br><b>Subject:</b> Re: [PATCH] Inverse post-order traversal for LiveVariables analysis, to recover the performance after r214064<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The analyzer is still timing out for me on postgresql.<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I am going to send a preprocessed file off line.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Maybe you will find some answers by looking at other performance related patches for LiveVariables that have been committed over years. <o:p></o:p></p></div><div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Anna.<o:p></o:p></p><div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal>On Oct 2, 2014, at 4:45 AM, Artyom Skrobov <<a href="mailto:Artyom.Skrobov@arm.com">Artyom.Skrobov@arm.com</a>> wrote:<o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hello,</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I see now that the CFG iteration orders, so painstakingly defined during the previous round of reviews in Aug, didn’t entirely match the pre-r214064 behaviour.</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Attached is a patch that simplifies PostOrderCFGView significantly, making the two possible iteration orders really obvious.</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I have tested it with both Alexander’s testcases (analyzer-regression1.c from Sep, and options.c from Aug), and it shows good performance on both.</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>OK to un-revert r218296, and to commit this patch on top of that?</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p></div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><div><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span class=apple-converted-space><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> </span></span><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Alexander Kornienko [<a href="mailto:alexfh@google.com">mailto:alexfh@google.com</a>]<span class=apple-converted-space> </span><br><b>Sent:</b><span class=apple-converted-space> </span>21 September 2014 01:16<br><b>To:</b><span class=apple-converted-space> </span>Artyom Skrobov<br><b>Cc:</b><span class=apple-converted-space> </span>Anna Zaks; <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a> Commits<br><b>Subject:</b><span class=apple-converted-space> </span>Re: [PATCH] Inverse post-order traversal for LiveVariables analysis, to recover the performance after r214064</span><o:p></o:p></p></div></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><div><p class=MsoNormal>I'm attaching one of the files that regressed after r214064 and never got fixed (preprocessed ceval.c from Python 3.3).<o:p></o:p></p></div><div><div><p class=MsoNormal> <o:p></o:p></p></div><div><div><p class=MsoNormal>On Sat, Sep 20, 2014 at 5:38 PM, Alexander Kornienko <<a href="mailto:alexfh@google.com" target="_blank"><span style='color:purple'>alexfh@google.com</span></a>> wrote:<o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>I actually still think, that I have some code that started taking large time to be analyzed after r214064 and didn't recover after r215650. But I didn't get to creating a reasonable repro for you. And the number of files left affected after r215650 is so small, that I didn't prioritize this high enough. I'll still try to provide a repro soon.<o:p></o:p></p><div><div><div><div><p class=MsoNormal>On 20 Sep 2014 17:10, "Artyom Skrobov" <<a href="mailto:Artyom.Skrobov@arm.com" target="_blank"><span style='color:purple'>Artyom.Skrobov@arm.com</span></a>> wrote:<o:p></o:p></p></div><div><div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Anna, do you mean the performance had been acceptable after r214064, but degraded after r215650, which fixed the performance regression introduced in r214064?</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Do you have any specific example of code that takes longer to compile after r215650?</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Not hearing back from Alexander since August, I assumed the performance regression he observed after r215650 was not in fact related to that commit.</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p></div><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><div><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span class=apple-converted-space><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> </span></span><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Anna Zaks [mailto:<a href="mailto:ganna@apple.com" target="_blank"><span style='color:purple'>ganna@apple.com</span></a>]<span class=apple-converted-space> </span><br><b>Sent:</b><span class=apple-converted-space> </span>20 September 2014 01:19<br><b>To:</b><span class=apple-converted-space> </span>Artyom Skrobov<br><b>Cc:</b><span class=apple-converted-space> </span><a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank"><span style='color:purple'>cfe-commits@cs.uiuc.edu</span></a><span class=apple-converted-space> </span>Commits; Ted Kremenek; Jordan Rose; Alexander Kornienko<br><b>Subject:</b><span class=apple-converted-space> </span>Re: [PATCH] Inverse post-order traversal for LiveVariables analysis, to recover the performance after r214064</span><o:p></o:p></p></div></div></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>Hi Artyom,<o:p></o:p></p></div><div><div><p class=MsoNormal> <o:p></o:p></p></div></div><div><div><p class=MsoNormal>Unfortunately, this commit (r215650) causes major performance regressions on our buildbots. In particular, building <span style='font-family:"Menlo","serif"'>postgresql-9.1</span> times out.<o:p></o:p></p></div></div><div><div><p class=MsoNormal> <o:p></o:p></p></div></div><div><div><p class=MsoNormal>Please, revert as soon as possible.<o:p></o:p></p></div></div><div><div><p class=MsoNormal> <o:p></o:p></p></div></div><div><div><p class=MsoNormal>Thank you,<o:p></o:p></p></div></div><div><div><p class=MsoNormal>Anna.<o:p></o:p></p></div><div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><div><p class=MsoNormal>On Aug 20, 2014, at 3:13 AM, Alexander Kornienko <<a href="mailto:alexfh@google.com" target="_blank"><span style='color:purple'>alexfh@google.com</span></a>> wrote:<o:p></o:p></p></div></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><div><div><div><div><p class=MsoNormal>On Fri, Aug 15, 2014 at 10:38 AM, Artyom Skrobov <<a href="mailto:Artyom.Skrobov@arm.com" target="_blank"><span style='color:purple'>Artyom.Skrobov@arm.com</span></a>> wrote:<o:p></o:p></p></div><div><p class=MsoNormal>Many thanks -- committed as r215650<br><br>Alexander, can you confirm that the analyzer performance is now acceptable<br>for your use cases?<o:p></o:p></p></div><div><div><p class=MsoNormal> <o:p></o:p></p></div></div><div><div><p class=MsoNormal>Artyom, sorry for the long delay. These files now work fine, but I still see up to 8-10 hours analysis time on a couple of other files. I'm sure I didn't see this before your first patch, but I can't yet tell in which revision it was introduced. I'll post more details and a repro later today.<o:p></o:p></p></div></div><div><div><p class=MsoNormal> <o:p></o:p></p></div></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'><div><p class=MsoNormal style='margin-bottom:12.0pt'><br><br>-----Original Message-----<br>From: Ted kremenek [mailto:<a href="mailto:kremenek@apple.com" target="_blank"><span style='color:purple'>kremenek@apple.com</span></a>]<br>Sent: 14 August 2014 16:36<br>To: Artyom Skrobov<br>Cc: Alexander Kornienko;<span class=apple-converted-space> </span><a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank"><span style='color:purple'>cfe-commits@cs.uiuc.edu</span></a><br>Subject: Re: [PATCH] Inverse post-order traversal for LiveVariables<br>analysis, to recover the performance after r214064<o:p></o:p></p></div><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Looks great to me.<br><br>> On Aug 14, 2014, at 3:08 AM, Artyom Skrobov <<a href="mailto:Artyom.Skrobov@arm.com" target="_blank"><span style='color:purple'>Artyom.Skrobov@arm.com</span></a>><br>wrote:<br>><br>> Thank you Ted!<br>><br>> Attaching the updated patch for a final review.<br>><br>> Summary of changes:<br>><br>> * Comments updated to reflect the two possible CFG traversal orders<br>> * PostOrderCFGView::po_iterator taken out of the header file<br>> * Iteration order for PostOrderCFGView changed to "reverse inverse<br>> post-order", the one required for a backward analysis<br>> * ReversePostOrderCFGView created, with the same iteration order that<br>> PostOrderCFGView used to have, the one required for a forward analysis<br>> * The two previous consumers of PostOrderCFGView, ThreadSafetyCommon.h and<br>> Consumed.cpp, switched to use ReversePostOrderCFGView<br>> * DataflowWorklistBase renamed to DataflowWorklist, and the two<br>> specializations named BackwardDataflowWorklist and ForwardDataflowWorklist<br>><br>> I believe this naming scheme matches the accepted terminology best.<o:p></o:p></p></div></div></blockquote></div></div></div><div><p class=MsoNormal>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank"><span style='color:purple'>cfe-commits@cs.uiuc.edu</span></a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank"><span style='color:purple'>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</span></a><o:p></o:p></p></div></div></blockquote></div><div><p class=MsoNormal> <o:p></o:p></p></div></div></div></div></div></div></div></div></div></div><p class=MsoNormal><PostOrderCFGView.patch><o:p></o:p></p></div></blockquote></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></body></html>