<div dir="ltr">As I mentioned in the previous comment, LLVM's current block placement does support outlining as in the following case:<div><br></div><div>START_A</div><div>if (__builtin_expect(cond,0)) {</div><div>        UNLIKELY_B</div><div>}</div><div>JOIN_C</div><div><br></div><div>The layout order will be START_A JOIN_C UNLIKELY_B</div><div><br></div><div>It is just in order to break the topo-order, it requires a very strongly biased branch (the cold target < 20% )</div><div><br></div><div>The alternatives include:</div><div>1) tune the threshold to break topo order</div><div>2) improve the static prediction in llvm.</div><div><br></div><div>David</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 4, 2015 at 12:17 AM, Daniel Jasper <span dir="ltr"><<a href="mailto:djasper@google.com" target="_blank">djasper@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Ah right.<br><br>Well, it might be too limiting, but it might be a good incremental step. Any further suggestions are definitely welcome.</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 4, 2015 at 9:04 AM, Xinliang David Li <span dir="ltr"><<a href="mailto:xinliangli@gmail.com" target="_blank">xinliangli@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The example mentioned has a diamond shape. Besides within the 'then' arm of cond1 branch, there could be multiple consecutive 'if (cond_x) B_x' where B_x blocks are cold. The heuristic in your patch seems to be too limiting.<span><font color="#888888"><div><br></div><div>David</div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 3, 2015 at 11:19 PM, Daniel Jasper <span dir="ltr"><<a href="mailto:djasper@google.com" target="_blank">djasper@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yes. The reasoning is that in this case the entire branch (containing A, B and C) will already be outlined and we don't want to fragment this further. In initial benchmarks, this seemed to have a slight benefit over additionally outlining B. Lots of stuff we can investigate, though.</div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 4, 2015 at 8:03 AM, Xinliang David Li <span dir="ltr"><<a href="mailto:xinliangli@gmail.com" target="_blank">xinliangli@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>If I read the change correctly,  'B' block in the following case can not be outlined. Is it intended?</div><div><br></div><div>David</div><div><br></div><div>if (cond1) {</div><div>    A</div><div>    if (cond2) {</div><div><br></div><div>         B</div><div>     }</div><div>    C</div><div>    ...</div><div>}</div><div>else {</div><div>   D</div><div>}</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Tue, Mar 3, 2015 at 10:46 PM, Daniel Jasper <span dir="ltr"><<a href="mailto:djasper@google.com" target="_blank">djasper@google.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Re-add the test.<br>
<div><div><br>
<br>
<a href="http://reviews.llvm.org/D7719" target="_blank">http://reviews.llvm.org/D7719</a><br>
<br>
Files:<br>
  lib/CodeGen/MachineBlockPlacement.cpp<br>
  test/CodeGen/X86/code_placement_outline_optional_branches.ll<br>
<br>
EMAIL PREFERENCES<br>
  <a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
</div></div><br></div></div><span>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></span></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>