[LoopUnroll] Clean up exit folding (NFC)
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 28 May 2021 18:14:32 +0000 (20:14 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 28 May 2021 20:31:13 +0000 (22:31 +0200)
commitf765445a691187c69a8a7c14991acb4589314e93
tree648b8fcaf375d575fe4ffc32218ff1a44816c1d1
parenta41309966a862be3817d05e4ae9ece60a7d8de86
[LoopUnroll] Clean up exit folding (NFC)

This does some non-functional cleanup of exit folding during
unrolling. The two main changes are:

 * First rewrite latch->header edges, which is unrelated to exit
   folding.
 * Combine folding for latch and non-latch exits. After the
   previous change, the only difference in their logic is that
   for non-latch exits we currently only fold "known non-exit"
   cases, but not "known exit" cases.

I think this helps a lot to clarify this code and prepare it for
future changes.

Differential Revision: https://reviews.llvm.org/D103333
llvm/lib/Transforms/Utils/LoopUnroll.cpp