[PATCH] D43876: [LoopUnroll] Peel off iterations if it makes conditions true/false.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 6 08:41:13 PDT 2018


fhahn added a comment.

In https://reviews.llvm.org/D43876#1057409, @mcrosier wrote:

> In https://reviews.llvm.org/D43876#1057247, @mcrosier wrote:
>
> > In https://reviews.llvm.org/D43876#1050460, @fhahn wrote:
> >
> > > @mcrosier I've submitted https://reviews.llvm.org/D44983 for review. It prevents peeling, if we cannot simplify the loop body after peeling. Peeling if we cannot simplify the loop body afterwards is likely not beneficial. It would be great if you could check if that helps in your case. If it's not easy for you to check, I can try and test it myself.
> > >
> > > Coming up with some additional heuristics, e.g. based on the number of instructions peeled and not eliminated, should be possible, but without knowing the inlining situation we would probably have to choose a rather arbitrary threshold.
> >
> >
> > Sure, I'll take a look now and let you know!  Sorry I didn't see this sooner.
>
>
> Unfortunately, https://reviews.llvm.org/D44983 does not fix this case. I'm going to dig into this now.  I'll update you once I have some additional findings.


I had a closer look at FullPelBlockMotionBiPred and we peeled off an iteration  because we have something like

  if (i % 2) {
    ...
    if (i != 0) {...}
   ...
  }

Peeling based on those nested conditional is likely to increase the code size too much compared to the benefit. https://reviews.llvm.org/D45374 only considers conditions in blocks that are executed on every iteration.


Repository:
  rL LLVM

https://reviews.llvm.org/D43876





More information about the llvm-commits mailing list