From: Richard Biener Date: Wed, 6 May 2020 11:20:38 +0000 (+0200) Subject: Prepare removal of SLP_INSTANCE_GROUP_SIZE X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4e849a74a8512cb313831a5929501ac2a735b7e1;p=gcc.git Prepare removal of SLP_INSTANCE_GROUP_SIZE This removes trivial instances of SLP_INSTANCE_GROUP_SIZE and refrains from using a "SLP instance" which nowadays is just one of the possibly many entries into the SLP graph. 2020-05-06 Richard Biener * tree-vectorizer.h (vect_transform_slp_perm_load): Adjust. * tree-vect-data-refs.c (vect_slp_analyze_node_dependences): Remove slp_instance parameter, just iterate over all scalar stmts. (vect_slp_analyze_instance_dependence): Adjust and likewise. * tree-vect-slp.c (vect_bb_slp_scalar_cost): Remove unused BB parameter. (vect_schedule_slp): Just iterate over all scalar stmts. (vect_supported_load_permutation_p): Adjust. (vect_transform_slp_perm_load): Remove slp_instance parameter, instead use the number of lanes in the node as group size. * tree-vect-stmts.c (vect_model_load_cost): Get vectorization factor instead of slp_instance as parameter. (vectorizable_load): Adjust. --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0adda498ccb..9e5a434a231 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2020-05-06 Richard Biener + + * tree-vectorizer.h (vect_transform_slp_perm_load): Adjust. + * tree-vect-data-refs.c (vect_slp_analyze_node_dependences): + Remove slp_instance parameter, just iterate over all scalar stmts. + (vect_slp_analyze_instance_dependence): Adjust and likewise. + * tree-vect-slp.c (vect_bb_slp_scalar_cost): Remove unused BB + parameter. + (vect_schedule_slp): Just iterate over all scalar stmts. + (vect_supported_load_permutation_p): Adjust. + (vect_transform_slp_perm_load): Remove slp_instance parameter, + instead use the number of lanes in the node as group size. + * tree-vect-stmts.c (vect_model_load_cost): Get vectorization + factor instead of slp_instance as parameter. + (vectorizable_load): Adjust. + 2020-05-06 Andreas Schwab * config/aarch64/driver-aarch64.c: Include "aarch64-protos.h". diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 7e9ab3ec333..d41ba49fabf 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -695,8 +695,7 @@ vect_slp_analyze_data_ref_dependence (vec_info *vinfo, disambiguating the loads. */ static bool -vect_slp_analyze_node_dependences (vec_info *vinfo, - slp_instance instance, slp_tree node, +vect_slp_analyze_node_dependences (vec_info *vinfo, slp_tree node, vec stores, stmt_vec_info last_store_info) { @@ -704,7 +703,7 @@ vect_slp_analyze_node_dependences (vec_info *vinfo, in NODE verifying we can sink them up to the last stmt in the group. */ stmt_vec_info last_access_info = vect_find_last_scalar_stmt_in_slp (node); - for (unsigned k = 0; k < SLP_INSTANCE_GROUP_SIZE (instance); ++k) + for (unsigned k = 0; k < SLP_TREE_SCALAR_STMTS (node).length (); ++k) { stmt_vec_info access_info = SLP_TREE_SCALAR_STMTS (node)[k]; if (access_info == last_access_info) @@ -794,13 +793,12 @@ vect_slp_analyze_instance_dependence (vec_info *vinfo, slp_instance instance) stmt_vec_info last_store_info = NULL; if (store) { - if (! vect_slp_analyze_node_dependences (vinfo, instance, store, - vNULL, NULL)) + if (! vect_slp_analyze_node_dependences (vinfo, store, vNULL, NULL)) return false; /* Mark stores in this instance and remember the last one. */ last_store_info = vect_find_last_scalar_stmt_in_slp (store); - for (unsigned k = 0; k < SLP_INSTANCE_GROUP_SIZE (instance); ++k) + for (unsigned k = 0; k < SLP_TREE_SCALAR_STMTS (store).length (); ++k) gimple_set_visited (SLP_TREE_SCALAR_STMTS (store)[k]->stmt, true); } @@ -811,7 +809,7 @@ vect_slp_analyze_instance_dependence (vec_info *vinfo, slp_instance instance) slp_tree load; unsigned int i; FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (instance), i, load) - if (! vect_slp_analyze_node_dependences (vinfo, instance, load, + if (! vect_slp_analyze_node_dependences (vinfo, load, store ? SLP_TREE_SCALAR_STMTS (store) : vNULL, last_store_info)) @@ -822,7 +820,7 @@ vect_slp_analyze_instance_dependence (vec_info *vinfo, slp_instance instance) /* Unset the visited flag. */ if (store) - for (unsigned k = 0; k < SLP_INSTANCE_GROUP_SIZE (instance); ++k) + for (unsigned k = 0; k < SLP_TREE_SCALAR_STMTS (store).length (); ++k) gimple_set_visited (SLP_TREE_SCALAR_STMTS (store)[k]->stmt, false); return res; diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index f83b568dcc1..c097840b09a 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -2018,7 +2018,7 @@ vect_supported_load_permutation_p (vec_info *vinfo, slp_instance slp_instn) vec tem; unsigned n_perms; if (!vect_transform_slp_perm_load (vinfo, node, tem, NULL, - 1, slp_instn, true, &n_perms)) + 1, true, &n_perms)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, @@ -2044,7 +2044,7 @@ vect_supported_load_permutation_p (vec_info *vinfo, slp_instance slp_instn) FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (slp_instn), i, node) if (node->load_permutation.exists () && !vect_transform_slp_perm_load (vinfo, node, vNULL, NULL, test_vf, - slp_instn, true, &n_perms)) + true, &n_perms)) return false; return true; @@ -2930,7 +2930,7 @@ vect_slp_analyze_operations (vec_info *vinfo) update LIFE according to uses of NODE. */ static void -vect_bb_slp_scalar_cost (vec_info *vinfo, basic_block bb, +vect_bb_slp_scalar_cost (vec_info *vinfo, slp_tree node, vec *life, stmt_vector_for_cost *cost_vec, hash_set &visited) @@ -3002,7 +3002,7 @@ vect_bb_slp_scalar_cost (vec_info *vinfo, basic_block bb, /* Do not directly pass LIFE to the recursive call, copy it to confine changes in the callee to the current child/subtree. */ subtree_life.safe_splice (*life); - vect_bb_slp_scalar_cost (vinfo, bb, child, &subtree_life, cost_vec, + vect_bb_slp_scalar_cost (vinfo, child, &subtree_life, cost_vec, visited); subtree_life.truncate (0); } @@ -3028,7 +3028,7 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo) { auto_vec life; life.safe_grow_cleared (SLP_INSTANCE_GROUP_SIZE (instance)); - vect_bb_slp_scalar_cost (bb_vinfo, BB_VINFO_BB (bb_vinfo), + vect_bb_slp_scalar_cost (bb_vinfo, SLP_INSTANCE_TREE (instance), &life, &scalar_costs, visited); } @@ -3866,13 +3866,12 @@ bool vect_transform_slp_perm_load (vec_info *vinfo, slp_tree node, vec dr_chain, gimple_stmt_iterator *gsi, poly_uint64 vf, - slp_instance slp_node_instance, bool analyze_only, - unsigned *n_perms) + bool analyze_only, unsigned *n_perms) { stmt_vec_info stmt_info = SLP_TREE_SCALAR_STMTS (node)[0]; int vec_index = 0; tree vectype = STMT_VINFO_VECTYPE (stmt_info); - unsigned int group_size = SLP_INSTANCE_GROUP_SIZE (slp_node_instance); + unsigned int group_size = SLP_TREE_SCALAR_STMTS (node).length (); unsigned int mask_element; machine_mode mode; @@ -4351,8 +4350,7 @@ vect_schedule_slp (vec_info *vinfo) if (is_a (vinfo)) vect_remove_slp_scalar_calls (vinfo, root); - for (j = 0; SLP_TREE_SCALAR_STMTS (root).iterate (j, &store_info) - && j < SLP_INSTANCE_GROUP_SIZE (instance); j++) + for (j = 0; SLP_TREE_SCALAR_STMTS (root).iterate (j, &store_info); j++) { if (!STMT_VINFO_DATA_REF (store_info)) break; diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index c41c7e3eb9b..38285871de6 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -1174,9 +1174,8 @@ vect_get_store_cost (vec_info *vinfo, stmt_vec_info stmt_info, int ncopies, static void vect_model_load_cost (vec_info *vinfo, - stmt_vec_info stmt_info, unsigned ncopies, + stmt_vec_info stmt_info, unsigned ncopies, poly_uint64 vf, vect_memory_access_type memory_access_type, - slp_instance instance, slp_tree slp_node, stmt_vector_for_cost *cost_vec) { @@ -1198,10 +1197,8 @@ vect_model_load_cost (vec_info *vinfo, unsigned n_perms; unsigned assumed_nunits = vect_nunits_for_cost (STMT_VINFO_VECTYPE (first_stmt_info)); - unsigned slp_vf = (ncopies * assumed_nunits) / instance->group_size; vect_transform_slp_perm_load (vinfo, slp_node, vNULL, NULL, - slp_vf, instance, true, - &n_perms); + vf, true, &n_perms); inside_cost += record_stmt_cost (cost_vec, n_perms, vec_perm, first_stmt_info, 0, vect_body); /* And adjust the number of loads performed. This handles @@ -8839,8 +8836,8 @@ vectorizable_load (vec_info *vinfo, memory_access_type, &gs_info, mask); STMT_VINFO_TYPE (stmt_info) = load_vec_info_type; - vect_model_load_cost (vinfo, stmt_info, ncopies, memory_access_type, - slp_node_instance, slp_node, cost_vec); + vect_model_load_cost (vinfo, stmt_info, ncopies, vf, memory_access_type, + slp_node, cost_vec); return true; } @@ -9137,7 +9134,7 @@ vectorizable_load (vec_info *vinfo, { unsigned n_perms; vect_transform_slp_perm_load (vinfo, slp_node, dr_chain, gsi, vf, - slp_node_instance, false, &n_perms); + false, &n_perms); } return true; } @@ -9896,8 +9893,7 @@ vectorizable_load (vec_info *vinfo, { unsigned n_perms; if (!vect_transform_slp_perm_load (vinfo, slp_node, dr_chain, gsi, vf, - slp_node_instance, false, - &n_perms)) + false, &n_perms)) { dr_chain.release (); return false; diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index a47ba1a6742..da6d37ac199 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -1852,7 +1852,7 @@ extern tree cse_and_gimplify_to_preheader (loop_vec_info, tree); extern void vect_free_slp_instance (slp_instance, bool); extern bool vect_transform_slp_perm_load (vec_info *, slp_tree, vec, gimple_stmt_iterator *, poly_uint64, - slp_instance, bool, unsigned *); + bool, unsigned *); extern bool vect_slp_analyze_operations (vec_info *); extern void vect_schedule_slp (vec_info *); extern opt_result vect_analyze_slp (vec_info *, unsigned);