<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 29, 2016 at 9:19 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">chandlerc added a subscriber: chandlerc.<br>
chandlerc added a comment.<br>
<br>
In <a href="https://reviews.llvm.org/D21405#459364" rel="noreferrer" target="_blank">https://reviews.llvm.org/D21405#459364</a>, @silvas wrote:<br>
<span class="gmail-"><br>
> In <a href="https://reviews.llvm.org/D21405#459242" rel="noreferrer" target="_blank">https://reviews.llvm.org/D21405#459242</a>, @mehdi_amini wrote:<br>
><br>
> > I really don't like the fact that the PGO pipeline will be different from the non-PGO pipeline (other than what is required for instrumentations). I wonder what other people will think of that.<br>
><br>
><br>
> This was one of my initial concerns too: <a href="http://lists.llvm.org/pipermail/llvm-dev/2015-August/089058.html" rel="noreferrer" target="_blank">http://lists.llvm.org/pipermail/llvm-dev/2015-August/089058.html</a><br>
>  Jake and I (actually mostly Jake) did some basic measurements related to this and did not find any significant difference.<br>
><br>
> Rong also did some measurements related to this in the initial RFC thread: <a href="http://lists.llvm.org/pipermail/llvm-dev/2015-August/089425.html" rel="noreferrer" target="_blank">http://lists.llvm.org/pipermail/llvm-dev/2015-August/089425.html</a><br>
><br>
</span>> I agree though: generally speaking, we should avoid running too many passes before instrumentation precisely because they cause divergence between the PGO and non-PGO pipelines. Thankfully Jake and I found that on our games only pre-inlining was needed (running other optimizations before instrumentation did not help significantly for our test cases beyond the benefit of just pre-inlining).<br>
<br>
<br>
I'm glad this is just pre-inlining, I strongly agree that we should not diverge here.<br>
<br>
I actually continue to disagree with pre-inlining. I have said this repeatedly in the past, and I'm not sure where we reached consensus that pre-inlining was the right design, and where the discussion of the tradeoffs took place. The closest I could find was the thread you linked to Sean, but I don't actually see a lot of discussion of alternatives there, nor do I see much real discussion of the inliner at all outside of the fact that yes, it does work.<br></blockquote><div><br></div><div><div>The original thread had some discussion of alternatives (and Rong even tried took measurements comparing against the alternative I suggested). Like David mentioned, the thread "RFC: Pass to prune redundant profiling instrumentation" had additional discussion of some alternatives.</div><div><br></div><div>Also, there doesn't seem to be a way to get the context-sensitive benefit without inlining of some sort prior to instrumentation. (except maybe cloning/specialization to get context-sensitivity, but that could have a large compile-time overhead and would affect inlining decisions later anyway, so it is not clear that it is really an improvement).</div></div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
I would be much more in favor of a design which instead of changing the pipeline to optimize differently (and thus having PGO vs. normal divergence) either:<br>
<br>
- Teaches the instrumentation pass to do the necessary (possibly interprocedural) analysis to instrument only in places it will be cheap, or<br>
- Teach the existing pipeline to actually optimize and transform the instrumentation code to remove the overhead as necessary.<br>
<br>
This way we have a single optimization pipeline that we turn profile info on and off of ,rather than twe pipelines.<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D21405" rel="noreferrer" target="_blank">https://reviews.llvm.org/D21405</a><br>
<br>
<br>
<br>
</div></div></blockquote></div><br></div></div>