https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113134
--- Comment #20 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think we want split_loop () handle this case. That means extending it to
handle loops with multiple exits. OTOH after loop rotation to
if (i_21 == 1001)
goto <bb 5>; [1.00%]
else
goto <bb 4>; [99.00%]
<bb 4> [local count: 1004539166]:
i_18 = i_21 + 1;
if (N_13(D) > i_18)
goto <bb 3>; [94.50%]
else
goto <bb 5>; [5.50%]
it could be also IVCANONs job to rewrite the exit test so the bound is
loop invariant and it becomes a single exit.
There's another recent PR where an exit condition like i < N && i < M
should become i < MIN(N,M).