From: Richard Sandiford Date: Tue, 31 Jul 2018 14:25:35 +0000 (+0000) Subject: [33/46] Use stmt_vec_infos instead of vec_info/gimple stmt pairs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d7609678843a0711cf77b5530149658c3997a906;p=gcc.git [33/46] Use stmt_vec_infos instead of vec_info/gimple stmt pairs This patch makes vect_record_max_nunits and vect_record_base_alignment take a stmt_vec_info instead of a vec_info/gimple pair. 2018-07-31 Richard Sandiford gcc/ * tree-vect-data-refs.c (vect_record_base_alignment): Replace vec_info and gimple stmt arguments with a stmt_vec_info. (vect_record_base_alignments): Update calls accordingly. * tree-vect-slp.c (vect_record_max_nunits): Replace vec_info and gimple stmt arguments with a stmt_vec_info. (vect_build_slp_tree_1): Remove vinfo argument and update call to vect_record_max_nunits. (vect_build_slp_tree_2): Update calls to vect_build_slp_tree_1 and vect_record_max_nunits. From-SVN: r263148 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ea675977431..2caade9e0a3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2018-07-31 Richard Sandiford + + * tree-vect-data-refs.c (vect_record_base_alignment): Replace vec_info + and gimple stmt arguments with a stmt_vec_info. + (vect_record_base_alignments): Update calls accordingly. + * tree-vect-slp.c (vect_record_max_nunits): Replace vec_info + and gimple stmt arguments with a stmt_vec_info. + (vect_build_slp_tree_1): Remove vinfo argument and update call + to vect_record_max_nunits. + (vect_build_slp_tree_2): Update calls to vect_build_slp_tree_1 + and vect_record_max_nunits. + 2018-07-31 Richard Sandiford * tree-vectorizer.h (nested_in_vect_loop_p): Move further down diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 5a36d098e49..f3cf4404bbd 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -794,14 +794,14 @@ vect_slp_analyze_instance_dependence (slp_instance instance) return res; } -/* Record in VINFO the base alignment guarantee given by DRB. STMT is - the statement that contains DRB, which is useful for recording in the - dump file. */ +/* Record the base alignment guarantee given by DRB, which occurs + in STMT_INFO. */ static void -vect_record_base_alignment (vec_info *vinfo, gimple *stmt, +vect_record_base_alignment (stmt_vec_info stmt_info, innermost_loop_behavior *drb) { + vec_info *vinfo = stmt_info->vinfo; bool existed; innermost_loop_behavior *&entry = vinfo->base_alignments.get_or_insert (drb->base_address, &existed); @@ -820,7 +820,7 @@ vect_record_base_alignment (vec_info *vinfo, gimple *stmt, " misalignment: %d\n", drb->base_misalignment); dump_printf_loc (MSG_NOTE, vect_location, " based on: "); - dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt_info->stmt, 0); } } } @@ -847,13 +847,13 @@ vect_record_base_alignments (vec_info *vinfo) && STMT_VINFO_VECTORIZABLE (stmt_info) && !STMT_VINFO_GATHER_SCATTER_P (stmt_info)) { - vect_record_base_alignment (vinfo, stmt_info, &DR_INNERMOST (dr)); + vect_record_base_alignment (stmt_info, &DR_INNERMOST (dr)); /* If DR is nested in the loop that is being vectorized, we can also record the alignment of the base wrt the outer loop. */ if (loop && nested_in_vect_loop_p (loop, stmt_info)) vect_record_base_alignment - (vinfo, stmt_info, &STMT_VINFO_DR_WRT_VEC_LOOP (stmt_info)); + (stmt_info, &STMT_VINFO_DR_WRT_VEC_LOOP (stmt_info)); } } } diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index d3c44bca406..07f10c0d2bf 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -609,14 +609,14 @@ compatible_calls_p (gcall *call1, gcall *call2) } /* A subroutine of vect_build_slp_tree for checking VECTYPE, which is the - caller's attempt to find the vector type in STMT with the narrowest + caller's attempt to find the vector type in STMT_INFO with the narrowest element type. Return true if VECTYPE is nonnull and if it is valid - for VINFO. When returning true, update MAX_NUNITS to reflect the - number of units in VECTYPE. VINFO, GORUP_SIZE and MAX_NUNITS are - as for vect_build_slp_tree. */ + for STMT_INFO. When returning true, update MAX_NUNITS to reflect the + number of units in VECTYPE. GROUP_SIZE and MAX_NUNITS are as for + vect_build_slp_tree. */ static bool -vect_record_max_nunits (vec_info *vinfo, gimple *stmt, unsigned int group_size, +vect_record_max_nunits (stmt_vec_info stmt_info, unsigned int group_size, tree vectype, poly_uint64 *max_nunits) { if (!vectype) @@ -625,7 +625,8 @@ vect_record_max_nunits (vec_info *vinfo, gimple *stmt, unsigned int group_size, { dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, "Build SLP failed: unsupported data-type in "); - dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, + stmt_info->stmt, 0); dump_printf (MSG_MISSED_OPTIMIZATION, "\n"); } /* Fatal mismatch. */ @@ -636,7 +637,7 @@ vect_record_max_nunits (vec_info *vinfo, gimple *stmt, unsigned int group_size, before adjusting *max_nunits for basic-block vectorization. */ poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype); unsigned HOST_WIDE_INT const_nunits; - if (is_a (vinfo) + if (STMT_VINFO_BB_VINFO (stmt_info) && (!nunits.is_constant (&const_nunits) || const_nunits > group_size)) { @@ -696,7 +697,7 @@ vect_two_operations_perm_ok_p (vec stmts, to (B1 <= A1 ? X1 : Y1); or be inverted to (A1 < B1) ? Y1 : X1. */ static bool -vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap, +vect_build_slp_tree_1 (unsigned char *swap, vec stmts, unsigned int group_size, poly_uint64 *max_nunits, bool *matches, bool *two_operators) @@ -763,7 +764,7 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap, if (!vect_get_vector_types_for_stmt (stmt_info, &vectype, &nunits_vectype) || (nunits_vectype - && !vect_record_max_nunits (vinfo, stmt_info, group_size, + && !vect_record_max_nunits (stmt_info, group_size, nunits_vectype, max_nunits))) { /* Fatal mismatch. */ @@ -1207,8 +1208,7 @@ vect_build_slp_tree_2 (vec_info *vinfo, { tree scalar_type = TREE_TYPE (PHI_RESULT (stmt)); tree vectype = get_vectype_for_scalar_type (scalar_type); - if (!vect_record_max_nunits (vinfo, stmt_info, group_size, vectype, - max_nunits)) + if (!vect_record_max_nunits (stmt_info, group_size, vectype, max_nunits)) return NULL; vect_def_type def_type = STMT_VINFO_DEF_TYPE (stmt_info); @@ -1241,7 +1241,7 @@ vect_build_slp_tree_2 (vec_info *vinfo, bool two_operators = false; unsigned char *swap = XALLOCAVEC (unsigned char, group_size); - if (!vect_build_slp_tree_1 (vinfo, swap, stmts, group_size, + if (!vect_build_slp_tree_1 (swap, stmts, group_size, &this_max_nunits, matches, &two_operators)) return NULL;