https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113136
--- Comment #8 from Tamar Christina <tnfchris at gcc dot gnu.org> --- Thanks, was able to reproduce with `--enable-checking=yes,rtl,extra`. The issue seems to be that the value is unused, and we were relying on DSE removing such statement. but with --enable-checking=yes,rtl,extra the extra verification is done before we can remove the dead statements on these inverted loops. That's why it doesn't fail without and produces the right code. So it looks like this is the same bug as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113137 and the fix for that should fix this. It looks like for these inverted loops, even though none of the values are used, I have to maintain the virtual phis. I'll keep the two separate for now..