Message ID | 55191D6D.8020901@mentor.com |
---|---|
State | New |
Headers | show |
On 30/03/15 11:54, Tom de Vries wrote: > On 30-03-15 10:15, Jan Hubicka wrote: >> Also move_sese_region_to_fn seem to mis updating of counts. Can you, >> please, add that and send updated patch? >> > > Like this? > > OK for stage1 if bootstrap and reg-test on x86_64 are ok? > Ping. Original posting at https://gcc.gnu.org/ml/gcc-patches/2015-03/msg01537.html . Thanks, - Tom > 0002-Preserve-edge-count-in-move_sese_region_to_fn.patch > > > Preserve edge count in move_sese_region_to_fn > > 2015-03-30 Tom de Vries<tom@codesourcery.com> > > * tree-cfg.c (move_sese_region_to_fn): Add entry_count and exit_count > arrays, and used the to propagate edge counts alongside edge > probabilities. > --- > gcc/tree-cfg.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c > index 6db6dff..ad528a3 100644 > --- a/gcc/tree-cfg.c > +++ b/gcc/tree-cfg.c > @@ -6976,6 +6976,7 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, > struct function *saved_cfun = cfun; > int *entry_flag, *exit_flag; > unsigned *entry_prob, *exit_prob; > + gcov_type *entry_count, *exit_count; > unsigned i, num_entry_edges, num_exit_edges, num_nodes; > edge e; > edge_iterator ei; > @@ -7014,10 +7015,12 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, > entry_pred = XNEWVEC (basic_block, num_entry_edges); > entry_flag = XNEWVEC (int, num_entry_edges); > entry_prob = XNEWVEC (unsigned, num_entry_edges); > + entry_count = XNEWVEC (gcov_type, num_entry_edges); > i = 0; > for (ei = ei_start (entry_bb->preds); (e = ei_safe_edge (ei)) != NULL;) > { > entry_prob[i] = e->probability; > + entry_count[i] = e->count; > entry_flag[i] = e->flags; > entry_pred[i++] = e->src; > remove_edge (e); > @@ -7029,10 +7032,12 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, > exit_succ = XNEWVEC (basic_block, num_exit_edges); > exit_flag = XNEWVEC (int, num_exit_edges); > exit_prob = XNEWVEC (unsigned, num_exit_edges); > + exit_count = XNEWVEC (gcov_type, num_exit_edges); > i = 0; > for (ei = ei_start (exit_bb->succs); (e = ei_safe_edge (ei)) != NULL;) > { > exit_prob[i] = e->probability; > + exit_count[i] = e->count; > exit_flag[i] = e->flags; > exit_succ[i++] = e->dest; > remove_edge (e); > @@ -7044,6 +7049,7 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, > exit_succ = NULL; > exit_flag = NULL; > exit_prob = NULL; > + exit_count = NULL; > } > > /* Switch context to the child function to initialize DEST_FN's CFG. */ > @@ -7221,12 +7227,14 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, > { > e = make_edge (entry_pred[i], bb, entry_flag[i]); > e->probability = entry_prob[i]; > + e->count = entry_count[i]; > } > > for (i = 0; i < num_exit_edges; i++) > { > e = make_edge (bb, exit_succ[i], exit_flag[i]); > e->probability = exit_prob[i]; > + e->count = exit_count[i]; > } > > set_immediate_dominator (CDI_DOMINATORS, bb, dom_entry); > @@ -7237,10 +7245,12 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, > if (exit_bb) > { > free (exit_prob); > + free (exit_count); > free (exit_flag); > free (exit_succ); > } > free (entry_prob); > + free (entry_count); > free (entry_flag); > free (entry_pred); > bbs.release (); > -- 1.9.1 >
On 06/14/2015 08:15 AM, Tom de Vries wrote: > On 30/03/15 11:54, Tom de Vries wrote: >> On 30-03-15 10:15, Jan Hubicka wrote: >>> Also move_sese_region_to_fn seem to mis updating of counts. Can you, >>> please, add that and send updated patch? >>> >> >> Like this? >> >> OK for stage1 if bootstrap and reg-test on x86_64 are ok? >> > > Ping. Original posting at > https://gcc.gnu.org/ml/gcc-patches/2015-03/msg01537.html . > > Thanks, > - Tom > >> 0002-Preserve-edge-count-in-move_sese_region_to_fn.patch >> >> >> Preserve edge count in move_sese_region_to_fn >> >> 2015-03-30 Tom de Vries<tom@codesourcery.com> >> >> * tree-cfg.c (move_sese_region_to_fn): Add entry_count and exit_count >> arrays, and used the to propagate edge counts alongside edge >> probabilities. Please include a testcase. I think you had one in the earlier patch submissions. OK with a testcase and fresh bootstrap/regression test. jeff
Preserve edge count in move_sese_region_to_fn 2015-03-30 Tom de Vries <tom@codesourcery.com> * tree-cfg.c (move_sese_region_to_fn): Add entry_count and exit_count arrays, and used the to propagate edge counts alongside edge probabilities. --- gcc/tree-cfg.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 6db6dff..ad528a3 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -6976,6 +6976,7 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, struct function *saved_cfun = cfun; int *entry_flag, *exit_flag; unsigned *entry_prob, *exit_prob; + gcov_type *entry_count, *exit_count; unsigned i, num_entry_edges, num_exit_edges, num_nodes; edge e; edge_iterator ei; @@ -7014,10 +7015,12 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, entry_pred = XNEWVEC (basic_block, num_entry_edges); entry_flag = XNEWVEC (int, num_entry_edges); entry_prob = XNEWVEC (unsigned, num_entry_edges); + entry_count = XNEWVEC (gcov_type, num_entry_edges); i = 0; for (ei = ei_start (entry_bb->preds); (e = ei_safe_edge (ei)) != NULL;) { entry_prob[i] = e->probability; + entry_count[i] = e->count; entry_flag[i] = e->flags; entry_pred[i++] = e->src; remove_edge (e); @@ -7029,10 +7032,12 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, exit_succ = XNEWVEC (basic_block, num_exit_edges); exit_flag = XNEWVEC (int, num_exit_edges); exit_prob = XNEWVEC (unsigned, num_exit_edges); + exit_count = XNEWVEC (gcov_type, num_exit_edges); i = 0; for (ei = ei_start (exit_bb->succs); (e = ei_safe_edge (ei)) != NULL;) { exit_prob[i] = e->probability; + exit_count[i] = e->count; exit_flag[i] = e->flags; exit_succ[i++] = e->dest; remove_edge (e); @@ -7044,6 +7049,7 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, exit_succ = NULL; exit_flag = NULL; exit_prob = NULL; + exit_count = NULL; } /* Switch context to the child function to initialize DEST_FN's CFG. */ @@ -7221,12 +7227,14 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, { e = make_edge (entry_pred[i], bb, entry_flag[i]); e->probability = entry_prob[i]; + e->count = entry_count[i]; } for (i = 0; i < num_exit_edges; i++) { e = make_edge (bb, exit_succ[i], exit_flag[i]); e->probability = exit_prob[i]; + e->count = exit_count[i]; } set_immediate_dominator (CDI_DOMINATORS, bb, dom_entry); @@ -7237,10 +7245,12 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, if (exit_bb) { free (exit_prob); + free (exit_count); free (exit_flag); free (exit_succ); } free (entry_prob); + free (entry_count); free (entry_flag); free (entry_pred); bbs.release (); -- 1.9.1