[runtimeunroll] Support multiple exits to latch exit w/epilogue loop
authorPhilip Reames <listmail@philipreames.com>
Wed, 18 Aug 2021 00:50:58 +0000 (17:50 -0700)
committerPhilip Reames <listmail@philipreames.com>
Wed, 18 Aug 2021 00:52:04 +0000 (17:52 -0700)
commit94d091429253e46e4cdd31a30e4d1b25b2879d6a
tree9069ec1933b78a8b088de67696bf541fe1f06770
parentb26e1efc424ad840143f02a96246cc666ee99e72
[runtimeunroll] Support multiple exits to latch exit w/epilogue loop

This patch extends the runtime unrolling infrastructure to support unrolling a loop with multiple exiting blocks branching to the same exit block used by the latch. It intentionally does not include a cost model change to enable this functionality unless appropriate force flags are used.

I decided to restrict this to the epilogue case. Given the changes ended up being pretty generic, we may be able to unblock the prolog case too, but I want to do that in a separate change to reduce the amount of code we all have to understand at one time.

Differential Revision: https://reviews.llvm.org/D107381
llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
llvm/test/Transforms/LoopUnroll/runtime-loop-multiple-exits.ll