https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103761
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Richard Sandiford <rsand...@gcc.gnu.org>: https://gcc.gnu.org/g:d037d9ad323ec9eef3e50c6e2cbc1e31191daa5d commit r12-8016-gd037d9ad323ec9eef3e50c6e2cbc1e31191daa5d Author: Richard Sandiford <richard.sandif...@arm.com> Date: Wed Apr 6 08:56:07 2022 +0100 vect: Fix mask handling for SLP gathers [PR103761] check_load_store_for_partial_vectors predates the support for SLP gathers and so had a hard-coded assumption that gathers/scatters (and load/stores lanes) would be non-SLP operations. This patch passes down the slp_node so that the routine can work out how many vectors are needed in both the SLP and non-SLP cases. gcc/ PR tree-optimization/103761 * tree-vect-stmts.cc (check_load_store_for_partial_vectors): Replace the ncopies parameter with an slp_node parameter. Calculate the number of vectors based on it and vectype. Rename lambda to group_memory_nvectors. (vectorizable_store, vectorizable_load): Update calls accordingly. gcc/testsuite/ PR tree-optimization/103761 * gcc.dg/vect/pr103761.c: New test. * gcc.target/aarch64/sve/pr103761.c: Likewise.