This isn't the required refactoring of vect_check_gather_scatter but it avoids a now unnecessary call to vect_is_simple_use which is problematic because it looks at STMT_VINFO_VECTYPE which we want to get rid of. SLP build already ensures vect_is_simple_use on all lane defs, so all we need is to populate the offset_vectype and offset_dt which is not always set by vect_check_gather_scatter. That's both easy to get from the SLP child directly.
* tree-vect-stmts.cc (get_load_store_type): Do not use vect_is_simple_use to fill gather/scatter offset operand vectype and dt. --- gcc/tree-vect-stmts.cc | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index e5971e4a357..4aa69da2218 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -2466,17 +2466,10 @@ get_load_store_type (vec_info *vinfo, stmt_vec_info stmt_info, vls_type == VLS_LOAD ? "gather" : "scatter"); return false; } - else if (!vect_is_simple_use (gs_info->offset, vinfo, - &gs_info->offset_dt, - &gs_info->offset_vectype)) - { - if (dump_enabled_p ()) - dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "%s index use not simple.\n", - vls_type == VLS_LOAD ? "gather" : "scatter"); - return false; - } - else if (gs_info->ifn == IFN_LAST && !gs_info->decl) + slp_tree offset_node = SLP_TREE_CHILDREN (slp_node)[0]; + gs_info->offset_dt = SLP_TREE_DEF_TYPE (offset_node); + gs_info->offset_vectype = SLP_TREE_VECTYPE (offset_node); + if (gs_info->ifn == IFN_LAST && !gs_info->decl) { if (!TYPE_VECTOR_SUBPARTS (vectype).is_constant () || !TYPE_VECTOR_SUBPARTS (gs_info->offset_vectype).is_constant () -- 2.43.0