Commit 5deaef19 by Zdenek Dvorak Committed by Zdenek Dvorak

tree-cfg.c (tree_duplicate_sese_region): Update profile.

	* tree-cfg.c (tree_duplicate_sese_region): Update profile.
	* tree-optimize.c (init_tree_optimization_passes) Swap
	pass_ch and pass_profile.
	* tree-ssa-loop-ch.c (copy_loop_headers): Do not update profile
	here.  Remove rewrite_into_loop_closed_ssa call.

From-SVN: r99547
parent e0bba093
2005-05-10 Zdenek Dvorak <dvorakz@suse.cz>
* tree-cfg.c (tree_duplicate_sese_region): Update profile.
* tree-optimize.c (init_tree_optimization_passes) Swap
pass_ch and pass_profile.
* tree-ssa-loop-ch.c (copy_loop_headers): Do not update profile
here. Remove rewrite_into_loop_closed_ssa call.
2005-05-10 Adrian Straetling <straetling@de.ibm.com>
* config/s390/s390.c: (s390_const_double_ok_for_constraint_p): New
......
......@@ -4847,6 +4847,7 @@ tree_duplicate_sese_region (edge entry, edge exit,
edge exit_copy;
basic_block *doms;
edge redirected;
int total_freq, entry_freq;
if (!can_copy_bbs_p (region, n_region))
return false;
......@@ -4893,12 +4894,24 @@ tree_duplicate_sese_region (edge entry, edge exit,
gcc_assert (!need_ssa_update_p ());
/* Record blocks outside the region that are duplicated by something
/* Record blocks outside the region that are dominated by something
inside. */
doms = xmalloc (sizeof (basic_block) * n_basic_blocks);
n_doms = get_dominated_by_region (CDI_DOMINATORS, region, n_region, doms);
total_freq = entry->dest->frequency;
entry_freq = EDGE_FREQUENCY (entry);
/* Fix up corner cases, to avoid division by zero or creation of negative
frequencies. */
if (total_freq == 0)
total_freq = 1;
else if (entry_freq > total_freq)
entry_freq = total_freq;
copy_bbs (region, n_region, region_copy, &exit, 1, &exit_copy, loop);
scale_bbs_frequencies_int (region, n_region, total_freq - entry_freq,
total_freq);
scale_bbs_frequencies_int (region_copy, n_region, entry_freq, total_freq);
if (copying_header)
{
......
......@@ -374,8 +374,8 @@ init_tree_optimization_passes (void)
NEXT_PASS (pass_phiopt);
NEXT_PASS (pass_may_alias);
NEXT_PASS (pass_tail_recursion);
NEXT_PASS (pass_ch);
NEXT_PASS (pass_profile);
NEXT_PASS (pass_ch);
NEXT_PASS (pass_stdarg);
NEXT_PASS (pass_sra);
/* FIXME: SRA may generate arbitrary gimple code, exposing new
......
......@@ -131,12 +131,10 @@ copy_loop_headers (void)
basic_block *bbs, *copied_bbs;
unsigned n_bbs;
unsigned bbs_size;
gcov_type entry_count, body_count, total_count;
loops = loop_optimizer_init (dump_file);
if (!loops)
return;
rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
/* We do not try to keep the information about irreducible regions
up-to-date. */
......@@ -202,8 +200,6 @@ copy_loop_headers (void)
exit = single_succ_edge (loop_split_edge_with (exit, NULL));
entry = loop_preheader_edge (loop);
entry_count = entry->src->count;
body_count = exit->dest->count;
if (!tree_duplicate_sese_region (entry, exit, bbs, n_bbs, copied_bbs))
{
......@@ -211,23 +207,6 @@ copy_loop_headers (void)
continue;
}
/* Fix profiling info. Scaling is done in gcov_type arithmetic to
avoid losing information; this is slow, but is done at most
once per loop. We special case 0 to avoid division by 0;
probably other special cases exist. */
total_count = body_count + entry_count;
if (total_count == 0LL)
{
scale_bbs_frequencies_int (bbs, n_bbs, 0, 1);
scale_bbs_frequencies_int (copied_bbs, n_bbs, 0, 1);
}
else
{
scale_bbs_frequencies_gcov_type (bbs, n_bbs, body_count, total_count);
scale_bbs_frequencies_gcov_type (copied_bbs, n_bbs, entry_count,
total_count);
}
/* Ensure that the latch and the preheader is simple (we know that they
are not now, since there was the loop exit condition. */
loop_split_edge_with (loop_preheader_edge (loop), NULL);
......
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