https://gcc.gnu.org/g:ad83da212ba5a5e27484fe7a147a28294fab8829
commit ad83da212ba5a5e27484fe7a147a28294fab8829 Author: Richard Biener <rguent...@suse.de> Date: Tue May 21 19:15:33 2024 +0200 Fix mixed input kind permute optimization When change_vec_perm_layout runs into a permute combining two nodes where one is invariant and one internal the partition of one input can be -1 but the other might not be. The following supports this case by simply ignoring inputs with input partiton -1. I'm not sure this is correct but it avoids ICEing when accessing that partitions layout for gcc.target/i386/pr98928.c with the change to avoid splitting store dataref groups during SLP discovery. * tree-vect-slp.cc (change_vec_perm_layout): Ignore an input partition of -1. (cherry picked from commit 3507ab1b018a68500e49fa9f1de7caa0f1b53dda) Diff: --- gcc/tree-vect-slp.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index f23a04560ff..2dbef5e7dc7 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -4727,6 +4727,8 @@ change_vec_perm_layout (slp_tree node, lane_permutation_t &perm, { slp_tree in_node = SLP_TREE_CHILDREN (node)[entry.first]; unsigned int in_partition_i = m_vertices[in_node->vertex].partition; + if (in_partition_i == -1u) + continue; this_in_layout_i = m_partitions[in_partition_i].layout; } if (this_in_layout_i > 0)