[PATCH] D102635: [LoopUnroll] Use tripcount from exiting header, if latch not exiting.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 18 15:04:58 PDT 2021


fhahn added a comment.



In D102635#2764658 <https://reviews.llvm.org/D102635#2764658>, @reames wrote:

> @fhahn I'm willing to defer to you here.  If you're really sure the TripCount is always interpreted as an upper bound, you can land and move forward.  From your description, it really sounds like this code is duplicating a lot of logic already existing in SCEV.  As a cleanup, it would be nice if we named the variables appropriately and used scev's existing distinction between exact and max trip counts.

After taking a closer look, I think we might be able to indeed re-use parts of SCEV in some parts. The variable names & co could also be clarified & improved. I'll look into some follow-up patches.

In D102635#2765051 <https://reviews.llvm.org/D102635#2765051>, @mkazantsev wrote:

> Just curious: how come that the loop wasn't rotated properly before unrolling? Looks like it's a pass ordering problem.

The case I am looking at uses `-Oz`, where `loop-rotate` is very conservative when it comes to duplicating code and does not rotate the loop (e.g. https://godbolt.org/z/fP6sna8qK). With all other optimization levels, the loop gets rotated.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102635/new/

https://reviews.llvm.org/D102635



More information about the llvm-commits mailing list