diff options
author | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-22 17:43:43 -0300 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-22 17:43:43 -0300 |
commit | a926878ddbd5a98b272c22171ce58663fc04c3e0 (patch) | |
tree | 86af256e5d9a9c06263c00adc90e5fe348008c43 /gcc/tree-loop-distribution.c | |
parent | 542730f087133690b47e036dfd43eb0db8a650ce (diff) | |
parent | 07cbaed8ba7d1b6e4ab3a9f44175502a4e1ecdb1 (diff) | |
download | gcc-a926878ddbd5a98b272c22171ce58663fc04c3e0.zip gcc-a926878ddbd5a98b272c22171ce58663fc04c3e0.tar.gz gcc-a926878ddbd5a98b272c22171ce58663fc04c3e0.tar.bz2 |
Merge branch 'autopar_rebase2' into autopar_develdevel/autopar_devel
Quickly commit changes in the rebase branch.
Diffstat (limited to 'gcc/tree-loop-distribution.c')
-rw-r--r-- | gcc/tree-loop-distribution.c | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 4442321..888af48 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -2080,7 +2080,8 @@ loop_distribution::pg_add_dependence_edges (struct graph *rdg, int dir, this_dir = -this_dir; /* Known dependences can still be unordered througout the - iteration space, see gcc.dg/tree-ssa/ldist-16.c. */ + iteration space, see gcc.dg/tree-ssa/ldist-16.c and + gcc.dg/tree-ssa/pr94969.c. */ if (DDR_NUM_DIST_VECTS (ddr) != 1) this_dir = 2; /* If the overlap is exact preserve stmt order. */ @@ -2144,6 +2145,8 @@ struct pg_edge_callback_data bitmap sccs_to_merge; /* Array constains component information for all vertices. */ int *vertices_component; + /* Array constains postorder information for all vertices. */ + int *vertices_post; /* Vector to record all data dependence relations which are needed to break strong connected components by runtime alias checks. */ vec<ddr_p> *alias_ddrs; @@ -2400,7 +2403,7 @@ loop_distribution::break_alias_scc_partitions (struct graph *rdg, vec<struct partition *> *partitions, vec<ddr_p> *alias_ddrs) { - int i, j, k, num_sccs, num_sccs_no_alias; + int i, j, k, num_sccs, num_sccs_no_alias = 0; /* Build partition dependence graph. */ graph *pg = build_partition_graph (rdg, partitions, false); @@ -2451,6 +2454,7 @@ loop_distribution::break_alias_scc_partitions (struct graph *rdg, cbdata.sccs_to_merge = sccs_to_merge; cbdata.alias_ddrs = alias_ddrs; cbdata.vertices_component = XNEWVEC (int, pg->n_vertices); + cbdata.vertices_post = XNEWVEC (int, pg->n_vertices); /* Record the component information which will be corrupted by next graph scc finding call. */ for (i = 0; i < pg->n_vertices; ++i) @@ -2459,6 +2463,11 @@ loop_distribution::break_alias_scc_partitions (struct graph *rdg, /* Collect data dependences for runtime alias checks to break SCCs. */ if (bitmap_count_bits (sccs_to_merge) != (unsigned) num_sccs) { + /* Record the postorder information which will be corrupted by next + graph SCC finding call. */ + for (i = 0; i < pg->n_vertices; ++i) + cbdata.vertices_post[i] = pg->vertices[i].post; + /* Run SCC finding algorithm again, with alias dependence edges skipped. This is to topologically sort partitions according to compilation time known dependence. Note the topological order @@ -2489,11 +2498,6 @@ loop_distribution::break_alias_scc_partitions (struct graph *rdg, if (cbdata.vertices_component[k] != i) continue; - /* Update to the minimal postordeer number of vertices in scc so - that merged partition is sorted correctly against others. */ - if (pg->vertices[j].post > pg->vertices[k].post) - pg->vertices[j].post = pg->vertices[k].post; - partition_merge_into (NULL, first, partition, FUSE_SAME_SCC); (*partitions)[k] = NULL; partition_free (partition); @@ -2504,6 +2508,29 @@ loop_distribution::break_alias_scc_partitions (struct graph *rdg, first->type = PTYPE_SEQUENTIAL; } } + /* Restore the postorder information if it's corrupted in finding SCC + with alias dependence edges skipped. If reduction partition's SCC is + broken by runtime alias checks, we force a negative post order to it + making sure it will be scheduled in the last. */ + if (num_sccs_no_alias > 0) + { + j = -1; + for (i = 0; i < pg->n_vertices; ++i) + { + pg->vertices[i].post = cbdata.vertices_post[i]; + struct pg_vdata *data = (struct pg_vdata *)pg->vertices[i].data; + if (data->partition && partition_reduction_p (data->partition)) + { + gcc_assert (j == -1); + j = i; + } + } + if (j >= 0) + pg->vertices[j].post = -1; + } + + free (cbdata.vertices_component); + free (cbdata.vertices_post); } sort_partitions_by_post_order (pg, partitions); |