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

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 17 14:14:06 PDT 2021


Meinersbur added a comment.

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

> This is semantically incorrect, and can not land.  There is an important distinction between a maximum trip count (which this code would be correct for), and an exact trip count (which is what this code appears to need).  Consider the case where the header exits after 20 iterations, and another non-latch exit exits after 10.  Fully unrolling by 20 would be incorrect.  (Since control flow is elided and we'd execute too many iterations.)

Does this mean only the branch in the latch is elided by (full) unrolling? The situation could also be that the latch exits after 20 iterations. I was not expecting that there is something special about the latch when exiting.


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