<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 12, 2017 at 9:26 AM, Michael Kuperstein <span dir="ltr"><<a href="mailto:mkuper@google.com" target="_blank">mkuper@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="auto"><div>I haven't looked at the patch yet, (and I'm also not at the office), but:<div dir="auto"><br></div><div dir="auto">1) The new probabilities should be the opposite of the last example Dehao had. That is, the external if should be 1/7, and the one on the backedge 7/28.</div></div></div></blockquote><div><br></div><div>For the 2nd case, the expected trip count is 0.2, thus it's not straight-forward to me how to set this. But if we make the expected trip count as 5, then looks to me the external if should be 5/1, and the one on the backedge should be 4/1?</div><div><br></div><div>And please make sure that when the input probability is the same, the output probability should also be the same. E.g., if you annotate the branch as (5, 1), and (10, 2), after the transformation, the probabilities should be equivalent.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><div dir="auto"><br></div><div dir="auto">2) I think this is just conditional probability - cond hasn't changed, but P(cond | cond has been true once) is lower than P(cond). This exactly corresponds to lowering the number of expected iterations by 1, given that we know we already executed one iteration.</div></div></div></blockquote><div><br></div><div>Seem with this patch, when we compute the estimated trip count, we need to first check if it's rotated or not: if yes, we use (BE.taken/BE.not_taken) + 1, otherwise, we use (BE.taken/BE.not_taken). Is that true?</div><div><br></div><div>Dehao</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><div><div class="h5"><br><div class="gmail_extra"><br><div class="gmail_quote">On Jan 12, 2017 09:21, "Xin Tong via Phabricator" <<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>> wrote:<br type="attribution"><blockquote class="m_5832446665385653814quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">trentxintong added a comment.<br>
<br>
@danielcdh Its the true the cond is not changed, but the inputs to the condition has changed, before you were testing with index variable in the loop header, now u have 2 conditions and the SSA values you use in the conditions have changed, so the probability needs to be adjusted. I will explain more when i get to office.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D28593" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2859<wbr>3</a><br>
<br>
<br>
<br>
</blockquote></div><br></div></div></div></div></div>
</blockquote></div><br></div></div>