The following removes get_vectype_for_scalar_type calls when we already have the vector type computed. It also avoids some premature and possibly redundant or unnecessary check during data-ref analysis for gathers.
* tree-vect-data-refs.cc (vect_analyze_data_refs): Do not check for a vector type for gather/scatter offset. vect_check_gather_scatter does that already. * tree-vect-loop.cc (get_initial_def_for_reduction): Use the computed vector type. * tree-vect-stmts.cc (vectorizable_operation): Use the known vector type for constants/externs. --- gcc/tree-vect-data-refs.cc | 4 +--- gcc/tree-vect-loop.cc | 2 +- gcc/tree-vect-stmts.cc | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc index d5c9c4a11c2..107dffe0a64 100644 --- a/gcc/tree-vect-data-refs.cc +++ b/gcc/tree-vect-data-refs.cc @@ -4721,9 +4721,7 @@ vect_analyze_data_refs (vec_info *vinfo, poly_uint64 *min_vf, bool *fatal) gather_scatter_info gs_info; if (!vect_check_gather_scatter (stmt_info, as_a <loop_vec_info> (vinfo), - &gs_info) - || !get_vectype_for_scalar_type (vinfo, - TREE_TYPE (gs_info.offset))) + &gs_info)) { if (fatal) *fatal = false; diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 6261cd1be1d..3a0731f3bea 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -5466,7 +5466,7 @@ get_initial_def_for_reduction (loop_vec_info loop_vinfo, { class loop *loop = LOOP_VINFO_LOOP (loop_vinfo); tree scalar_type = TREE_TYPE (init_val); - tree vectype = get_vectype_for_scalar_type (loop_vinfo, scalar_type); + tree vectype = STMT_VINFO_VECTYPE (reduc_info); tree init_def; gimple_seq stmts = NULL; diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 390c8472fd6..5ad306e2b08 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -6914,7 +6914,8 @@ vectorizable_operation (vec_info *vinfo, S2: z = x + 1 - VS2_0 */ vect_get_vec_defs (vinfo, stmt_info, slp_node, ncopies, - op0, &vec_oprnds0, op1, &vec_oprnds1, op2, &vec_oprnds2); + op0, vectype, &vec_oprnds0, op1, vectype, &vec_oprnds1, + op2, vectype, &vec_oprnds2); /* Arguments are ready. Create the new vector stmt. */ FOR_EACH_VEC_ELT (vec_oprnds0, i, vop0) { -- 2.35.3