<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 4, 2016 at 11:26 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"><span class="">danielcdh marked 13 inline comments as done.<br>
danielcdh added a comment.<br>
<br>
</span>Thanks for the reviews!<br>
<br>
<br>
<br>
> chandlerc wrote in LoopSink.cpp:148-170<br>
<span class="">> This seems really expensive. By my reading this is O(N * L * M) where L is theĀ  number of basic blocks in a loop, N is the number of instructions we try to sink into that loop, and M is the number of basic blocks within the loop that use the instructions. If there is for example one hot basic block in the loop and a large number of cold basic blocks and all of the uses are in those cold basic blocks, it seems like this could become quite large.<br>
><br>
> Have you looked at other algorithms? Is there a particular reason to go with this one? (I've not thought about the problem very closely yet...)<br>
<br>
</span>I initially started with an adhoc algorithm which is O(L * M), but Danny pointed out it is not optimal, so I changed to this optimal algorithm. The lower bound for any sinking algorithm is O(L*M), but if optimal solution is desired, O(N*L*M) is the best I can get.<br></blockquote><div><br></div><div>It's possible to sink optimally in less time by building a form specific to the problem, but it's probably not worth it ATM.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
<br>
</blockquote></div><br></div></div>