https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126028
--- Comment #3 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:3adb3325954177939d59031055fc08a81ae21be3 commit r17-2478-g3adb3325954177939d59031055fc08a81ae21be3 Author: Richard Biener <[email protected]> Date: Wed Jul 15 11:33:50 2026 +0200 Improve BB vectorization of reductions When there's not a uniform chain of operations gathered from the reduction operation chain we currently simply fail and to make success more likely we strip off the last operation to make the number of lanes at least even. This isn't ideal and somewhat random as can be seen in PR126028 which is the motivating case and has a three lane reduction. So the following removes the early stripping down to an even number of lanes and uses SLP discovery of the whole group to direct re-analysis of the larger of the matching or non-matching part. For gcc.dg/vect/pr106081.c we now BB vectorize parts which just confuses the loop vectorization dump scanning, so disable it. PR tree-optimization/126028 * tree-vect-slp.cc (vect_slp_check_for_roots): Do not force the BB reduction root to have an even number of lanes. (vect_build_slp_instance): For failed discovery of a BB reduction attempt to re-try discovery on the matching or non-matching part. * gcc.dg/vect/bb-slp-reduc-2.c: New testcase. * gcc.dg/vect/bb-slp-reduc-3.c: Likewise. * gcc.dg/vect/pr106081.c: Disable BB vectorization.
