[LoopDeletion] Handle switch in proving that loop exits on first iteration
authorMax Kazantsev <mkazantsev@azul.com>
Fri, 9 Jul 2021 10:40:42 +0000 (17:40 +0700)
committerMax Kazantsev <mkazantsev@azul.com>
Fri, 9 Jul 2021 11:03:34 +0000 (18:03 +0700)
commit9c5e65691e129a816ea4bba10be103ca67172ca5
tree2e53c773773a550c3139a9c899af3768f4fc6748
parent38c9a4068df5c44433da3fc15789cef8ce71367d
[LoopDeletion] Handle switch in proving that loop exits on first iteration

Added check for switch-terminated blocks in loops.
Now if a block is terminated with a switch, we try to find out which of the
cases is taken on 1st iteration and mark corresponding edge from the block
to the case successor as live.

Patch by Dmitry Makogon!

Differential Revision: https://reviews.llvm.org/D105688
Reviewed By: nikic, mkazantsev
llvm/lib/Transforms/Scalar/LoopDeletion.cpp
llvm/test/Transforms/LoopDeletion/eval_first_iteration.ll