https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103202
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Sergei Trofimovich from comment #3) > Created attachment 51776 [details] > main_loop_simpler.c > > Attaching seemingly simpler example. I applied most inlines and simplified > loops as much as I could. It looks like VRP does something funny with: > > while (n > 0) > { > while (n-- > 0) > { > > Looking at 039t.mergephi1 > > with -fno-tree-vrp: > > --- no-vrp/ed-main_loop.c.039t.mergephi1 2021-11-12 09:07:55.120821967 > +0000 > +++ yes-vrp/ed-main_loop.c.039t.mergephi1 2021-11-12 09:07:55.186822973 > +0000 > @@ -93,7 +93,7 @@ > # np_6 = PHI <np_7(10), np_40(6)> > # n_8 = PHI <n_9(10), n_23(6)> > n_23 = n_8 + -1; > - if (n_8 > 0) > + if (n_8 != 0) > goto <bb 4>; [INV] > else > goto <bb 8>; [INV] > > I think our loop is executed with n == -1 on real data and vrp provided > incorrect range. But how would the inner loop be reachable with n == -1?