https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117875
--- Comment #12 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
I tried final_value_replacement_loop on simplified testcase where second loop
has known number of iterations:
void foo(int *a, int *b, int n)
{
if (n > 3 && n < 10)
for (int i = 0; i <= n;i++)
a[i]+=b[i<n-3? i-1 : i];
}
(testcase is truly artificial, but lsplit disables itself very happily on more
natural candidates)
Situation is not so easy, since final_value_replacement_loop needs loop closed
ssa form that is rebuilt only after the pass is done. Also even with LCSSA it
does not seem to expose the invariant...