<div dir="ltr">Daniel, <div><br></div><div>your patch strongly is strongly in favor of outlining even when edge A->C is not the best successor edge in terms of branch probability -- note the condition SuccProb > HotProb.getCompl() which is 20% if I read it correctly.</div><div><br></div><div>Outlining aggressively has the side effect of 1) increasing code size (due to the unconditional branch, possibly long branch) and 2) increases the number of taken branches dynamically.</div><div><br></div><div>In fact, the tuning can be done by simply adjusting the HotProb value -- as this control flow pattern should be covered (as one of the cases) in the following code:</div><div><br></div><div>if (SuccChain.LoopPredecessor != 0) {</div><div> ...</div><div>}</div><div><br></div><div>You probably don't need to compute postDom either -- the CFG shape can be easilly checked by peeking at the predecessor/successor blocks.</div><div><br></div><div>thanks,</div><div><br></div><div>David</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 18, 2015 at 1:47 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">Hi chandlerc,<br>
<br>
In a CFG with the edges A->B->C and A->C, B is an optional branch.<br>
<br>
LLVM's default behavior is to lay the blocks out naturally, i.e. A, B, C, in order to improve code locality and fall throughs. However, if a function contains many of those optional branches only a few of which are taken, this leads to a lot of unnecessary icache misses. Moving B out of line can work around this.<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>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">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></blockquote></div><br></div>