https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124052
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
For example
void foo (int *x, int n, int m)
{
int i = 0;
if (n != 0 || m != 0)
do
{
x[i++] = 1;
}
while ((i < n) & (i < m));
}
is handled because the exit condition is replaced with i < max(n,m)
PR127510 has an exit condition like
void foo (int *x, int sn, int sm, int n, int m)
{
int i = sn;
int j = sm;
if (n != 0 || m != 0)
do
{
x[i++] = 1;
j++;
}
while ((i != n) & (i != m));
}
so there are N IVs that need to arrive at their exit value at the same
time for the loop to terminate. This might or might not be something
to optimize separately - that is, rewrite in IVCANON (which requires
niter to be computable...). Rewrite { a, +, CST }, { b, +, CST }
with same CST to { 0, +, CST } and replace uses by init + IV and then
version the loop on the condition it can terminate.