Commit 6ff37519 by Bin Cheng Committed by Bin Cheng

re PR tree-optimization/81369 (ICE in generate_code_for_partition)

	PR target/81369
	* tree-loop-distribution.c (classify_partition): Only assert on
	numer of iterations.
	(merge_dep_scc_partitions): Delete prameter.  Update function call.
	(distribute_loop): Remove code handling loop with unknown niters.
	(pass_loop_distribution::execute): Skip loop with unknown niters.

From-SVN: r250270
parent aa1528b5
2017-07-17 Bin Cheng <bin.cheng@arm.com> 2017-07-17 Bin Cheng <bin.cheng@arm.com>
PR target/81369 PR target/81369
* tree-loop-distribution.c (classify_partition): Only assert on
numer of iterations.
(merge_dep_scc_partitions): Delete prameter. Update function call.
(distribute_loop): Remove code handling loop with unknown niters.
(pass_loop_distribution::execute): Skip loop with unknown niters.
2017-07-17 Bin Cheng <bin.cheng@arm.com>
PR target/81369
* tree-loop-distribution.c (merge_dep_scc_partitions): Sink call to * tree-loop-distribution.c (merge_dep_scc_partitions): Sink call to
function sort_partitions_by_post_order. function sort_partitions_by_post_order.
......
...@@ -1412,8 +1412,7 @@ classify_partition (loop_p loop, struct graph *rdg, partition *partition, ...@@ -1412,8 +1412,7 @@ classify_partition (loop_p loop, struct graph *rdg, partition *partition,
return; return;
nb_iter = number_of_latch_executions (loop); nb_iter = number_of_latch_executions (loop);
if (!nb_iter || nb_iter == chrec_dont_know) gcc_assert (nb_iter && nb_iter != chrec_dont_know);
return;
if (dominated_by_p (CDI_DOMINATORS, single_exit (loop)->src, if (dominated_by_p (CDI_DOMINATORS, single_exit (loop)->src,
gimple_bb (DR_STMT (single_store)))) gimple_bb (DR_STMT (single_store))))
plus_one = true; plus_one = true;
...@@ -1962,18 +1961,16 @@ sort_partitions_by_post_order (struct graph *pg, ...@@ -1962,18 +1961,16 @@ sort_partitions_by_post_order (struct graph *pg,
} }
/* Given reduced dependence graph RDG merge strong connected components /* Given reduced dependence graph RDG merge strong connected components
of PARTITIONS. If IGNORE_ALIAS_P is true, data dependence caused by of PARTITIONS. In this function, data dependence caused by possible
possible alias between references is ignored, as if it doesn't exist alias between references is ignored, as if it doesn't exist at all. */
at all; otherwise all depdendences are considered. */
static void static void
merge_dep_scc_partitions (struct graph *rdg, merge_dep_scc_partitions (struct graph *rdg,
vec<struct partition *> *partitions, vec<struct partition *> *partitions)
bool ignore_alias_p)
{ {
struct partition *partition1, *partition2; struct partition *partition1, *partition2;
struct pg_vdata *data; struct pg_vdata *data;
graph *pg = build_partition_graph (rdg, partitions, ignore_alias_p); graph *pg = build_partition_graph (rdg, partitions, true);
int i, j, num_sccs = graphds_scc (pg, NULL); int i, j, num_sccs = graphds_scc (pg, NULL);
/* Strong connected compoenent means dependence cycle, we cannot distribute /* Strong connected compoenent means dependence cycle, we cannot distribute
...@@ -2420,9 +2417,6 @@ distribute_loop (struct loop *loop, vec<gimple *> stmts, ...@@ -2420,9 +2417,6 @@ distribute_loop (struct loop *loop, vec<gimple *> stmts,
auto_vec<struct partition *, 3> partitions; auto_vec<struct partition *, 3> partitions;
rdg_build_partitions (rdg, stmts, &partitions); rdg_build_partitions (rdg, stmts, &partitions);
/* Can't do runtime alias check if loop niter is unknown. */
tree niters = number_of_latch_executions (loop);
bool rt_alias_check_p = (niters != NULL_TREE && niters != chrec_dont_know);
auto_vec<ddr_p> alias_ddrs; auto_vec<ddr_p> alias_ddrs;
auto_bitmap stmt_in_all_partitions; auto_bitmap stmt_in_all_partitions;
...@@ -2511,9 +2505,9 @@ distribute_loop (struct loop *loop, vec<gimple *> stmts, ...@@ -2511,9 +2505,9 @@ distribute_loop (struct loop *loop, vec<gimple *> stmts,
/* Build the partition dependency graph. */ /* Build the partition dependency graph. */
if (partitions.length () > 1) if (partitions.length () > 1)
{ {
merge_dep_scc_partitions (rdg, &partitions, rt_alias_check_p); merge_dep_scc_partitions (rdg, &partitions);
alias_ddrs.truncate (0); alias_ddrs.truncate (0);
if (rt_alias_check_p && partitions.length () > 1) if (partitions.length () > 1)
break_alias_scc_partitions (rdg, &partitions, &alias_ddrs); break_alias_scc_partitions (rdg, &partitions, &alias_ddrs);
} }
...@@ -2654,6 +2648,11 @@ pass_loop_distribution::execute (function *fun) ...@@ -2654,6 +2648,11 @@ pass_loop_distribution::execute (function *fun)
if (!optimize_loop_for_speed_p (loop)) if (!optimize_loop_for_speed_p (loop))
continue; continue;
/* Don't distribute loop if niters is unknown. */
tree niters = number_of_latch_executions (loop);
if (niters == NULL_TREE || niters == chrec_dont_know)
continue;
/* Initialize the worklist with stmts we seed the partitions with. */ /* Initialize the worklist with stmts we seed the partitions with. */
bbs = get_loop_body_in_dom_order (loop); bbs = get_loop_body_in_dom_order (loop);
for (i = 0; i < loop->num_nodes; ++i) for (i = 0; i < loop->num_nodes; ++i)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment