<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 10, 2016 at 11:01 AM, Dehao Chen <span dir="ltr"><<a href="mailto:danielcdh@gmail.com" target="_blank">danielcdh@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">danielcdh added a comment.<br>
<span class=""><br>
In <a href="http://reviews.llvm.org/D19950#425287" rel="noreferrer" target="_blank">http://reviews.llvm.org/D19950#425287</a>, @hfinkel wrote:<br>
<br>
> In <a href="http://reviews.llvm.org/D19950#425286" rel="noreferrer" target="_blank">http://reviews.llvm.org/D19950#425286</a>, @hfinkel wrote:<br>
><br>
> > In <a href="http://reviews.llvm.org/D19950#425285" rel="noreferrer" target="_blank">http://reviews.llvm.org/D19950#425285</a>, @davidxl wrote:<br>
> ><br>
> > > Static prediction has been conservative in estimating loop trip count -- it produces something like 30ish iterations. If the a very hot loop has a big if-then-else (or switch), it is very likely to mark many bbs' to be colder than the loop header.   Turning on this for static prediction really depends on the false rate. It seems to be this can get wrong pretty easily for very hot loops (which is also the most important thing to optimize for).<br>
> ><br>
> ><br>
> > This is a good point. There's no universal conservative choice (assuming a small trip count is conservative in some cases, and assuming a large trip count is conservative in other cases).<br>
><br>
><br>
> Would it be better (and practical) if there were some way for the BFI client to specify which kind of 'conservative' is desired?<br>
><br>
</span><span class="">> Also, why are we doing this instead of sinking later (in CGP or similar)? LICM can expose optimization opportunities, plus represents a code pattern the user might input manually. Sinking later seems more robust.<br>
<br>
<br>
</span>I looked at CGP pass, looks like it's handling the sinking case-by-case (e.g. there is separate routine to handle sinking of load, gep, etc. I'm afraid this would miss opportunities. Additionally, the file-level comment of CGP pass says "This works around limitations in it's basic-block-at-a-time approach. It should eventually be removed."<br></blockquote><div><br></div><div><br></div><div>Perhaps you can do profile driven sinking CGP separately to handle manually hoisted code situation mentioned by Hal.</div><div><br></div><div>David</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I'm not quite clear why it helps to move code out of loop early and later sink it inside. Could you give an example or some more context?<br>
<br>
Thanks,<br>
Dehao<br>
<br>
<br>
<a href="http://reviews.llvm.org/D19950" rel="noreferrer" target="_blank">http://reviews.llvm.org/D19950</a><br>
<br>
<br>
<br>
</blockquote></div><br></div></div>