<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: arial,helvetica,sans-serif; font-size: 10pt; color: #000000'><br><hr id="zwchr"><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; color: rgb(0, 0, 0); font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><b>From: </b>"Xinliang David Li" <davidxl@google.com><br><b>To: </b>reviews+D26037+public+89d2f1349c56fe36@reviews.llvm.org<br><b>Cc: </b>"陈德颢" <danielcdh@gmail.com>, "Hal Finkel" <hfinkel@anl.gov>, "Junbum Lim" <junbuml@codeaurora.org>, "llvm-commits" <llvm-commits@lists.llvm.org>, anna@azul.com<br><b>Sent: </b>Friday, October 28, 2016 12:11:04 PM<br><b>Subject: </b>Re: [PATCH] D26037: Add LoopSink pass for PGO.<br><br><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 28, 2016 at 9:40 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: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">danielcdh added a comment.<br>
<br>
We need this pass to remove LCSSA nodes because this will be the last loop pass.<br>
<br>
Another question is: shall we pin this pass to PGO only? If not, we can simply add it to lib/Transforms/IPO/PassManagerBuilder.cpp<br></blockquote><div><br></div><div id="DWT5029">Static branch prediction is conservative in predicting loop iterations (loop scale). This means it is likely some blocks (if wrapped under __builtin_expect) inside the loop will be wrongly marked as colder than preheader  which can trigger loop sinking wrongly. </div></div></div></div></blockquote>Can you please elaborate? If we statically predict a modest number of iterations, which seems like a reasonable trade off, and we have a block which is expected to not execute (because of __builtin_expect), then is it obviously wrong that it should be colder than the preheader? If the opposite of __builtin_expect is "almost never", which is true for error paths and the like, then that seems not unreasonable. Why would loop sinking hurt there?<br><br>Thanks again,<br>Hal<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; color: rgb(0, 0, 0); font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>  Making this pass depending on PGO is a safer thing to do.<br></div><div><br></div><div>David</div><div><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
<br>
<a href="https://reviews.llvm.org/D26037" rel="noreferrer" target="_blank">https://reviews.llvm.org/D26037</a><br>
<br>
<br>
<br>
</blockquote></div><br></div></div>
</blockquote><br><br><br>-- <br><div><span name="x"></span>Hal Finkel<br>Lead, Compiler Technology and Programming Languages<br>Leadership Computing Facility<br>Argonne National Laboratory<span name="x"></span><br></div></div></body></html>