https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119773
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- maybe_optimize_sub_cmp_0 doesn't change behavior on the testcase at all (at least on the trunk) though. Most likely SLSR bug, -fno-tree-slsr makes it go away, will verify in the morning.