Hi All, This modifies vectorizable_slp_permutation to update the type of the children of a perm node before trying to permute them. This allows us to be able to permute invariant nodes.
This will be covered by test from the SLP pattern matcher. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: * tree-vect-slp.c (vectorizable_slp_permutation): Update types on nodes when needed. --- inline copy of patch -- diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index d2f2407ac92f23724387e893a24c6661b514dafb..92af9cb698a70ae899f31da01415253782ada5d8 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -5114,7 +5114,8 @@ vectorizable_slp_permutation (vec_info *vinfo, gimple_stmt_iterator *gsi, slp_tree child; unsigned i; FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child) - if (!types_compatible_p (SLP_TREE_VECTYPE (child), vectype)) + if (!vect_maybe_update_slp_op_vectype (child, vectype) + || !types_compatible_p (SLP_TREE_VECTYPE (child), vectype)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, --
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index d2f2407ac92f23724387e893a24c6661b514dafb..92af9cb698a70ae899f31da01415253782ada5d8 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -5114,7 +5114,8 @@ vectorizable_slp_permutation (vec_info *vinfo, gimple_stmt_iterator *gsi, slp_tree child; unsigned i; FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child) - if (!types_compatible_p (SLP_TREE_VECTYPE (child), vectype)) + if (!vect_maybe_update_slp_op_vectype (child, vectype) + || !types_compatible_p (SLP_TREE_VECTYPE (child), vectype)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,