https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128615
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <[email protected]>: https://gcc.gnu.org/g:74cd90132516624104d353e370e660c861a81958 commit r17-6164-g74cd90132516624104d353e370e660c861a81958 Author: Richard Biener <[email protected]> Date: Thu Nov 12 08:09:46 2026 +0100 tree-optimization/128615 - wrong unrolling with max latch execution count When the latch execution count is the maximum value of its type then the number of header executions wraps to zero. This is a common cause of wrong-code. The following fixes one such issue in the generic loop unroller infrastructure for example exercised by predictive commoning. There is no good way to improve the early out for non-constant niter, so I only bother with constant niter now. PR tree-optimization/128615 * tree-ssa-loop-manip.cc (determine_exit_conditions): Avoid wrapping to zero when computing the header execution count when determining an early out. * gcc.dg/torture/pr128615.c: New testcase.
