https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113734
--- Comment #27 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tamar Christina <tnfch...@gcc.gnu.org>: https://gcc.gnu.org/g:491e57451df47cda88f658601a92d6d006ae09d7 commit r14-8952-g491e57451df47cda88f658601a92d6d006ae09d7 Author: Tamar Christina <tamar.christ...@arm.com> Date: Tue Feb 13 11:04:38 2024 +0000 middle-end: update vector loop upper bounds when early break vect [PR113734] When doing early break vectorization we should treat the final iteration as possibly being partial. This so that when we calculate the vector loop upper bounds we take into account that final iteration could have done some work. The attached testcase shows that if we don't then cunroll may unroll the loop an if the upper bound is wrong we lose a vector iteration. This is similar to how we adjust the scalar loop bounds for the PEELED case. gcc/ChangeLog: PR tree-optimization/113734 * tree-vect-loop.cc (vect_transform_loop): Treat the final iteration of an early break loop as partial. gcc/testsuite/ChangeLog: PR tree-optimization/113734 * gcc.dg/vect/vect-early-break_117-pr113734.c: New test.