https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103202
--- Comment #3 from Sergei Trofimovich <slyfox at gcc dot gnu.org> --- Created attachment 51776 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51776&action=edit 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.