https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126998
--- Comment #6 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:408162bbcde30c7d6672a20f96aa6dc7a1c5fa58 commit r17-3694-g408162bbcde30c7d6672a20f96aa6dc7a1c5fa58 Author: Richard Biener <[email protected]> Date: Wed Aug 26 13:46:22 2026 +0200 tree-optimization/126998 - avoid vect_get_num_copies on SLP inputs The following avoids using vect_get_num_copies on the SLP input from vectorizable_lane_reducing which is in this case used for costing. The transform phase will simply look at the actual number of vector inputs code generated, but for costing we can use vect_get_num_copies_for_invariant which is exported with the patch. It must be possible to compute the number from the number of vector outputs, the number of SLP lanes and the width of the elements involved, but given what the transform phase does this matches it exactly. PR tree-optimization/126998 * tree-vectorizer.h (vect_get_num_copies_for_invariant): Declare. * tree-vect-slp.cc (vect_get_num_copies_for_invariant): Export. * tree-vect-loop.cc (vectorizable_lane_reducing): Use vect_get_num_copies_for_invariant on the SLP input. * gcc.dg/vect/vect-reduc-dot-pr126998.c: New testcase.
