summaryrefslogtreecommitdiff
path: root/gcc/tree-loop-distribution.c
diff options
context:
space:
mode:
authorBin Cheng <bin.cheng@linux.alibaba.com>2020-03-16 11:09:14 +0800
committerBin Cheng <bin.cheng@linux.alibaba.com>2020-03-16 11:11:42 +0800
commite4e9a59105a81cdd6c1328b0a5ed9fe4cc82840e (patch)
tree10c62b24264529db7f77c3b0e85dc5c9dc2901e5 /gcc/tree-loop-distribution.c
parent5e5ce5371f6a8199108eeade587261bf5593dedf (diff)
Update post order number for merged SCC.
Function loop_distribution::break_alias_scc_partitions needs to compute SCC with runtime alias edges skipped. As a result, partitions could be re-assigned larger post order number than SCC's precedent partition and distributed before the precedent one. This fixes the issue by updating the merged partition to the minimal post order in SCC. gcc/ PR tree-optimization/94125 * tree-loop-distribution.c (loop_distribution::break_alias_scc_partitions): Update post order number for merged scc. gcc/testsuite/ PR tree-optimization/94125 * gcc.dg/tree-ssa/pr94125.c: New test.
Diffstat (limited to 'gcc/tree-loop-distribution.c')
-rw-r--r--gcc/tree-loop-distribution.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 35d3821bb07..44423215332 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -2489,14 +2489,11 @@ loop_distribution::break_alias_scc_partitions (struct graph *rdg,
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;
- }
+ /* 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);