[IndVars] Break backedge and replace PHIs if loop exits on 1st iteration
authorMax Kazantsev <mkazantsev@azul.com>
Mon, 13 Sep 2021 04:29:33 +0000 (11:29 +0700)
committerMax Kazantsev <mkazantsev@azul.com>
Mon, 13 Sep 2021 04:30:55 +0000 (11:30 +0700)
commitd9ca444835e67960df927d5b8cade57776fdd8cb
tree62e554e76a4bbcc880fa0fe8abb7042107d70155
parent5a6dfb27ca7424f15a20f9bb7ec90d858865faa3
[IndVars] Break backedge and replace PHIs if loop exits on 1st iteration

Implement TODO in optimizeLoopExits. Now if we have proved that some loop exit
is taken on 1st iteration, we make all branches in the following exiting blocks
always branch out of the loop and their conditions simplified away.

Patch by Dmitry Makogon!

Differential Revision: https://reviews.llvm.org/D108910
Reviewed By: lebedev.ri
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
llvm/test/Transforms/IndVarSimplify/eliminate-backedge.ll