<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=us-ascii"><meta name=Generator content="Microsoft Word 14 (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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-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:windowtext;}
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='color:#1F497D'>I agree we should have this assert in place, especially for the time being where the assumption that a node is conservatively allocatable does not seem to hold.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>The patch looks good to me, but I leave the final word to Lang.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Cheers,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>--<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Arnaud<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><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"'> Jonas Paulsson [mailto:jonas.paulsson@ericsson.com] <br><b>Sent:</b> 06 February 2015 12:26<br><b>To:</b> Lang Hames; Arnaud De Grandmaison<br><b>Cc:</b> llvm-commits@cs.uiuc.edu<br><b>Subject:</b> [PATCH] Assert in PBQP: A conservatively allocatable node should never be spilled.<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US>Hi,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>I have polished up my patch for the assert regarding conservatively allocatable nodes. I find this assert to be desirable, as there is an implementation error somewhere if any of these nodes are spilled, but that is something that may not be detected, as most often the output is still legal. InlineSpiller only complains if a spilled register is spilled again, for instance.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Can I commit this or do you have any comments / opinion on this?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>/Jonas Paulsson<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Patch:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>From 64ecd655faa1a1d133247fefc545472c042e6368 Mon Sep 17 00:00:00 2001<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>From: Jonas Paulsson <<a href="mailto:jonas.paulsson@ericsson.com">jonas.paulsson@ericsson.com</a>><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Date: Wed, 28 Jan 2015 08:30:35 +0100<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Subject: [PATCH] Assert in PBQP: A conservatively allocatable node should<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>never be spilled.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>---<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>include/llvm/CodeGen/RegAllocPBQP.h | 16 ++++++++++++++++<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>1 file changed, 16 insertions(+)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>diff --git a/include/llvm/CodeGen/RegAllocPBQP.h b/include/llvm/CodeGen/RegAllocPBQP.h<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>index cfa6160..140abed8 100644<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>--- a/include/llvm/CodeGen/RegAllocPBQP.h<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>+++ b/include/llvm/CodeGen/RegAllocPBQP.h<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>@@ -308,6 +308,13 @@ public:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>     setup();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>     S = backpropagate(G, reduce());<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>     G.unsetSolver();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>+<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>+#ifndef NDEBUG<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>+    for (auto NId : WasConservativelyAllocables)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>+      assert (S.getSelection(NId) != PBQP::RegAlloc::getSpillOptionIdx() &&<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>+              "A conservatively allocatable node was spilled!");<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>+#endif<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>+<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>     return S;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>   }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>@@ -464,6 +471,9 @@ private:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>         NodeStack.push_back(NId);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>         G.disconnectAllNeighborsFromNode(NId);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>+#ifndef NDEBUG<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>+        WasConservativelyAllocables.insert(NId);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>+#endif<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>       } else if (!NotProvablyAllocatableNodes.empty()) {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>         NodeSet::iterator NItr =<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>           std::min_element(NotProvablyAllocatableNodes.begin(),<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>@@ -497,6 +507,12 @@ private:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>   NodeSet OptimallyReducibleNodes;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>   NodeSet ConservativelyAllocatableNodes;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>   NodeSet NotProvablyAllocatableNodes;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>+<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>+#ifndef NDEBUG<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>+  // A set of nodes to that were conservatively allocatable and are<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>+  // thus never supposed to be spilled.<o:p></o:p></span></p><p class=MsoNormal><span lang=SV>+  NodeSet WasConservativelyAllocables;<o:p></o:p></span></p><p class=MsoNormal><span lang=SV>+#endif<o:p></o:p></span></p><p class=MsoNormal><span lang=SV>};<o:p></o:p></span></p></div></div></body></html>