diff options
author | Bin Cheng <bin.cheng@arm.com> | 2017-10-11 13:04:05 +0000 |
---|---|---|
committer | Bin Cheng <amker@gcc.gnu.org> | 2017-10-11 13:04:05 +0000 |
commit | b4ec1d31a5d605c8bea45ca919d3a60dfdac771f (patch) | |
tree | 215a0f5f821b87eac0949692a888c06e737e2b04 /gcc/tree-loop-distribution.c | |
parent | 3a266bcd811d8fdf3e9ad9134c40324aafa1bac9 (diff) | |
download | gcc-b4ec1d31a5d605c8bea45ca919d3a60dfdac771f.zip gcc-b4ec1d31a5d605c8bea45ca919d3a60dfdac771f.tar.gz gcc-b4ec1d31a5d605c8bea45ca919d3a60dfdac771f.tar.bz2 |
re PR tree-optimization/82472 (ICE in generate_code_for_partition, at tree-loop-distribution.c:1145)
PR tree-optimization/82472
* tree-loop-distribution.c (sort_partitions_by_post_order): Refine
comment.
(break_alias_scc_partitions): Update postorder number.
gcc/testsuite
* gcc.dg/tree-ssa/pr82472.c: New test.
From-SVN: r253641
Diffstat (limited to 'gcc/tree-loop-distribution.c')
-rw-r--r-- | gcc/tree-loop-distribution.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 999b32e..98ad50e 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -1943,7 +1943,8 @@ build_partition_graph (struct graph *rdg, return pg; } -/* Sort partitions in PG by post order and store them in PARTITIONS. */ +/* Sort partitions in PG in descending post order and store them in + PARTITIONS. */ static void sort_partitions_by_post_order (struct graph *pg, @@ -1952,7 +1953,7 @@ sort_partitions_by_post_order (struct graph *pg, int i; struct pg_vdata *data; - /* Now order the remaining nodes in postorder. */ + /* Now order the remaining nodes in descending postorder. */ qsort (pg->vertices, pg->n_vertices, sizeof (vertex), pgcmp); partitions->truncate (0); for (i = 0; i < pg->n_vertices; ++i) @@ -2048,7 +2049,7 @@ break_alias_scc_partitions (struct graph *rdg, vec<struct partition *> *partitions, vec<ddr_p> *alias_ddrs) { - int i, j, num_sccs, num_sccs_no_alias; + int i, j, k, num_sccs, num_sccs_no_alias; /* Build partition dependence graph. */ graph *pg = build_partition_graph (rdg, partitions, false); @@ -2121,18 +2122,26 @@ break_alias_scc_partitions (struct graph *rdg, for (j = 0; partitions->iterate (j, &first); ++j) if (cbdata.vertices_component[j] == i) break; - for (++j; partitions->iterate (j, &partition); ++j) + for (k = j + 1; partitions->iterate (k, &partition); ++k) { struct pg_vdata *data; - if (cbdata.vertices_component[j] != i) + if (cbdata.vertices_component[k] != i) continue; + /* Update postorder number so that merged reduction partition is + sorted after other partitions. */ + if (!partition_reduction_p (first) + && partition_reduction_p (partition)) + { + gcc_assert (pg->vertices[k].post < pg->vertices[j].post); + pg->vertices[j].post = pg->vertices[k].post; + } partition_merge_into (NULL, first, partition, FUSE_SAME_SCC); - (*partitions)[j] = NULL; + (*partitions)[k] = NULL; partition_free (partition); - data = (struct pg_vdata *)pg->vertices[j].data; - gcc_assert (data->id == j); + data = (struct pg_vdata *)pg->vertices[k].data; + gcc_assert (data->id == k); data->partition = NULL; } } |