<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;}
/* 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;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@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-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">In method MachineSinking::PostponeSplitCriticalEdge(), in the last section it says:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> // It's only legal to break critical edge and sink the computation to the<o:p></o:p></p>
<p class="MsoNormal"> // new block if all the predecessors of "To", except for "From", are<o:p></o:p></p>
<p class="MsoNormal"> // not dominated by "From". Given SSA property, this means these<o:p></o:p></p>
<p class="MsoNormal"> // predecessors are dominated by "To".<o:p></o:p></p>
<p class="MsoNormal"> //<o:p></o:p></p>
<p class="MsoNormal"> // There is no need to do this check if all the uses are PHI nodes. PHI<o:p></o:p></p>
<p class="MsoNormal"> // sources are only defined on the specific predecessor edges.<o:p></o:p></p>
<p class="MsoNormal"> if (!BreakPHIEdge) {<o:p></o:p></p>
<p class="MsoNormal"> for (MachineBasicBlock::pred_iterator PI = ToBB->pred_begin(),<o:p></o:p></p>
<p class="MsoNormal"> E = ToBB->pred_end(); PI != E; ++PI) {<o:p></o:p></p>
<p class="MsoNormal"> if (*PI == FromBB)<o:p></o:p></p>
<p class="MsoNormal"> continue;<o:p></o:p></p>
<p class="MsoNormal"> if (!DT->dominates(ToBB, *PI))<o:p></o:p></p>
<p class="MsoNormal"> return false;<o:p></o:p></p>
<p class="MsoNormal"> }<o:p></o:p></p>
<p class="MsoNormal"> }<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I find this a bit strange and suspect an error, since the loop checks if ToBB dominates all its predecessors.<o:p></o:p></p>
<p class="MsoNormal">The only case I can think of is a one block loop…<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I wonder what “Given SSA property, this means these predecessors are dominated by "To"” means.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Could it perhaps be rewritten to:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> for (MachineBasicBlock::pred_iterator PI = ToBB->pred_begin(),<o:p></o:p></p>
<p class="MsoNormal"> E = ToBB->pred_end(); PI != E; ++PI) {<o:p></o:p></p>
<p class="MsoNormal"> if (*PI == FromBB)<o:p></o:p></p>
<p class="MsoNormal"> continue;<o:p></o:p></p>
<p class="MsoNormal"> if (DT->dominates(FromBB, *PI))<o:p></o:p></p>
<p class="MsoNormal"> return false;<o:p></o:p></p>
<p class="MsoNormal"> }<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I also wonder by the way, why MachineSink bothers to split blocks and why there is a FIXME comment about sinking<o:p></o:p></p>
<p class="MsoNormal">instructions lower in the same block. Isn’t that the job of the mischeduler, to put those instructions<o:p></o:p></p>
<p class="MsoNormal">near the end of the block if there are no local uses?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best regards,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Jonas Paulsson<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>