<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 23, 2017 at 8:33 PM, Kyle Butt via Phabricator <span dir="ltr"><<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">iteratee added inline comments.<br>
<span class="gmail-"><br>
<br>
================<br>
Comment at: lib/CodeGen/<wbr>MachineBlockPlacement.cpp:642<br>
+  // increases fallthrough.<br>
+  if (SuccSuccs.size() == 0)<br>
+    return true;<br>
----------------<br>
davidxl wrote:<br>
> davidxl wrote:<br>
> > I assume this is loop back edge source block. You need a test case to cover it.<br>
> test case for this?<br>
</span>It's not just a back edge. I added a test case.<br>
<span class="gmail-"><br>
<br>
================<br>
Comment at: lib/CodeGen/<wbr>MachineBlockPlacement.cpp:671<br>
+  BranchProbability PProb = MBPI->getEdgeProbability(BB, Succ);<br>
+  BlockFrequency P = BBFreq * PProb;<br>
+  // At this point, we don't know which block would be chosen instead of Succ.<br>
----------------<br>
davidxl wrote:<br>
> Add a short cut here with comments:<br>
><br>
> // If P is not larger, the best successor selection loop will eventually select C, not Succ (as it is not profitable to do so).<br>
> if (P <= Qout)<br>
>    return false;<br>
</span>If we weren't estimating Qout, I'd agree. Instead we'll skip calling this altogether if we know that we won't use the result.<br></blockquote><div><br></div><div>I don't understand the reply. The early check I suggested is basically:</div><div><br></div><div>if ( AdjustedSumProb - PProb > PProb)</div><div>   return false;</div><div><br></div><div>David</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
<a href="https://reviews.llvm.org/D28583" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D28583</a><br>
<br>
<br>
<br>
</blockquote></div><br></div></div>