<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 17, 2016 at 11:36 AM, David Li <span dir="ltr"><<a href="mailto:davidxl@google.com" target="_blank">davidxl@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">davidxl added a comment.<br>
<br>
M is the number of use BBs.<br>
<br>
The pass already filters out loops which do not have any cold blocks -- this effectively filters out most of the loops in reality so the compile time impact will be minimal. Further more, the following can be done:<br>
<br>
1. only collect cold bbs in the loop body that is colder than header and sort them instead<br></blockquote><div><br></div><div>This was already done before sorting:</div><div><br></div><div><div>  for (BasicBlock *B : L.blocks())</div><div>​    if (BFI.getBlockFreq(B) <= BFI.getBlockFreq(L.getLoopPreheader())) {</div><div>​      SortedLoopBBs.push_back(B);</div><div>​      LoopBlockNumber[B] = ++i;</div><div>​    }</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
2. skip any instructions with use BBs that are not member of the cold BBs collected in 1).<br></blockquote><div><br></div><div>This may not be optimal because one inst may have use in a hot BB, but may have BB's parent (int DT) very code. So we can sink to the cold parent.</div><div><br></div><div>Dehao</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
<a href="https://reviews.llvm.org/D22778" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D22778</a><br>
<br>
<br>
<br>
</blockquote></div><br></div></div>