https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113210
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #8) > Created attachment 56993 [details] > gcc14-pr113210.patch > > So, I'd go with this patch (so far untested). I think we want to keep the invariant that both are INTEGER_CST when one is. If we can fold the add to 1 why can't we fold the original to 0? That is, another fix might be to adjust NITERSM1 to NITERS - 1 when NITERS went constant ... (btw, I want to get rid of _NITERS and only keep _NITERSM1 given _NITERS cannot be represented when the number of latch iterations is TYPE_MAX_VALUE)