[PATCH] D22778: Add Loop Sink pass to reverse the LICM based of basic block frequency.

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 4 11:37:30 PDT 2016


On Tue, Oct 4, 2016 at 11:26 AM, Dehao Chen <danielcdh at gmail.com> wrote:

> danielcdh marked 13 inline comments as done.
> danielcdh added a comment.
>
> Thanks for the reviews!
>
>
>
> > chandlerc wrote in LoopSink.cpp:148-170
> > 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.
> >
> > 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...)
>
> 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.
>

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.

>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161004/a0003243/attachment.html>


More information about the llvm-commits mailing list