<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 27, 2014 at 1:48 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@gmail.com" target="_blank">chandlerc@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 class="im"><div class="gmail_quote">On Mon, Jan 27, 2014 at 1:41 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@gmail.com" target="_blank">chandlerc@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><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="overflow:hidden">

---- Block Freqs ----<br>
 entry = 1.0<br>
  entry -> if.else = 0.375<br>
  entry -> if.then = 0.625<br>
 if.then = 0.625<br>
  if.then -> if.end22 = 0.625<br>
 if.else = 0.375<br>
  if.else -> for.cond.preheader = 0.1406<br>
  if.else -> if.end22 = 0.23437<br>
 for.cond.preheader = 0.1406<br>
  for.cond.preheader -> <a href="http://for.body.lr.ph" target="_blank">for.body.lr.ph</a> = 0.08789<br>
  for.cond.preheader -> for.end = 0.05273<br>
 <a href="http://for.body.lr.ph" target="_blank">for.body.lr.ph</a> = 0.08789                   ### Preheader in question<br>
  <a href="http://for.body.lr.ph" target="_blank">for.body.lr.ph</a> -> for.body = 0.08789<br>
 for.body = 2.8125                          ### Loop in question</div></blockquote><div><br></div></div><div>Oh goodness. These static frequencies don't really make any sense at all. But they're also not wrong at all. ARRRRG!</div>

</blockquote></div><br></div>Oh my, its worse than that. I've not thought about the block frequencies this way before, but it appears that with the current model, inlining a function call guarded by a branch has the perplexing property of making any blocks within the function colder relative to their function's entry block.</blockquote>
</div><br>OK, I have a better mental model for this. I'll send something to the dev list for general discussion, and change this to be something much much more conservative in two ways:</div><div class="gmail_extra"><br>
</div><div class="gmail_extra">1) Only apply to nested loops</div><div class="gmail_extra">2) Require a more significant bias than 20%, maybe the same bias produced by __builtin_expect.</div><div class="gmail_extra"><br></div>
<div class="gmail_extra">Does that make sense as a short term solution? I can also hide this behind a flag to experiment as this heuristic is firing *may* more often than I ever expected it to.</div></div>