diff options
author | Richard Biener <rguenther@suse.de> | 2020-11-16 14:26:20 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-11-16 15:21:25 +0100 |
commit | c84df34aec3bb845b22384c7e85f0449ca00dd99 (patch) | |
tree | d20af3436e7286e5f93606651a4007e2d17f06aa /gcc | |
parent | d1746388db6481d87f5a801d79b17566fc6888da (diff) | |
download | gcc-c84df34aec3bb845b22384c7e85f0449ca00dd99.zip gcc-c84df34aec3bb845b22384c7e85f0449ca00dd99.tar.gz gcc-c84df34aec3bb845b22384c7e85f0449ca00dd99.tar.bz2 |
Delay SLP instance loads gathering
This delays filling SLP_INSTANCE_LOADS.
2020-11-16 Richard Biener <rguenther@suse.de>
* tree-vectorizer.h (vect_gather_slp_loads): Declare.
* tree-vect-loop.c (vect_analyze_loop_2): Call
vect_gather_slp_loads.
* tree-vect-slp.c (vect_build_slp_instance): Do not gather
SLP loads here.
(vect_gather_slp_loads): Remove wrapper, new function.
(vect_slp_analyze_bb_1): Call it.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/tree-vect-loop.c | 3 | ||||
-rw-r--r-- | gcc/tree-vect-slp.c | 26 | ||||
-rw-r--r-- | gcc/tree-vectorizer.h | 1 |
3 files changed, 22 insertions, 8 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 4d5532f..ecaaf01 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -2298,6 +2298,9 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal, unsigned *n_stmts) /* Optimize the SLP graph with the vectorization factor fixed. */ vect_optimize_slp (loop_vinfo); + + /* Gather the loads reachable from the SLP graph entries. */ + vect_gather_slp_loads (loop_vinfo); } bool saved_can_use_partial_vectors_p diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index b98d5db..d2f2407 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -2071,13 +2071,6 @@ vect_gather_slp_loads (vec<slp_tree> &loads, slp_tree node, } } -static void -vect_gather_slp_loads (slp_instance inst, slp_tree node) -{ - hash_set<slp_tree> visited; - vect_gather_slp_loads (SLP_INSTANCE_LOADS (inst), node, visited); -} - /* Find the last store in SLP INSTANCE. */ @@ -2252,7 +2245,6 @@ vect_build_slp_instance (vec_info *vinfo, new_instance->cost_vec = vNULL; new_instance->subgraph_entries = vNULL; - vect_gather_slp_loads (new_instance, node); if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location, "SLP size %u vs. limit %u.\n", @@ -3071,6 +3063,21 @@ vect_optimize_slp (vec_info *vinfo) } } +/* Gather loads reachable from the individual SLP graph entries. */ + +void +vect_gather_slp_loads (vec_info *vinfo) +{ + unsigned i; + slp_instance instance; + FOR_EACH_VEC_ELT (vinfo->slp_instances, i, instance) + { + hash_set<slp_tree> visited; + vect_gather_slp_loads (SLP_INSTANCE_LOADS (instance), + SLP_INSTANCE_TREE (instance), visited); + } +} + /* For each possible SLP instance decide whether to SLP it and calculate overall unrolling factor needed to SLP the loop. Return TRUE if decided to SLP at @@ -4152,6 +4159,9 @@ vect_slp_analyze_bb_1 (bb_vec_info bb_vinfo, int n_stmts, bool &fatal, /* Optimize permutations. */ vect_optimize_slp (bb_vinfo); + /* Gather the loads reachable from the SLP graph entries. */ + vect_gather_slp_loads (bb_vinfo); + vect_record_base_alignments (bb_vinfo); /* Analyze and verify the alignment of data references and the diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 3ccd0fd..0ee4ef3 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -1974,6 +1974,7 @@ extern opt_result vect_analyze_slp (vec_info *, unsigned); extern bool vect_make_slp_decision (loop_vec_info); extern void vect_detect_hybrid_slp (loop_vec_info); extern void vect_optimize_slp (vec_info *); +extern void vect_gather_slp_loads (vec_info *); extern void vect_get_slp_defs (slp_tree, vec<tree> *); extern void vect_get_slp_defs (vec_info *, slp_tree, vec<vec<tree> > *, unsigned n = -1U); |