Commit e7bd94cc by Zdenek Dvorak Committed by Zdenek Dvorak

cfgloop.c (update_latch_info): Update dominator of the new block.

	* cfgloop.c (update_latch_info): Update dominator of the new block.
	(canonicalize_loop_headers, flow_loops_find): Do not free dominance
	info.
	* dominance.c (verify_dominators): Check that the dominance tree is
	connected.
	(recount_dominator): Ignore unreachable blocks.
	(iterate_fix_dominators): Cleanup old dominance information before
	recomputing it.

From-SVN: r85307
parent d397dbcd
2004-07-29 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* cfgloop.c (update_latch_info): Update dominator of the new block.
(canonicalize_loop_headers, flow_loops_find): Do not free dominance
info.
* dominance.c (verify_dominators): Check that the dominance tree is
connected.
(recount_dominator): Ignore unreachable blocks.
(iterate_fix_dominators): Cleanup old dominance information before
recomputing it.
2004-07-29 Diego Novillo <dnovillo@redhat.com> 2004-07-29 Diego Novillo <dnovillo@redhat.com>
* tree-ssa-operands.c (get_expr_operands): Revert changes * tree-ssa-operands.c (get_expr_operands): Revert changes
......
...@@ -575,6 +575,7 @@ update_latch_info (basic_block jump) ...@@ -575,6 +575,7 @@ update_latch_info (basic_block jump)
HEADER_BLOCK (jump) = 0; HEADER_BLOCK (jump) = 0;
alloc_aux_for_edge (jump->pred, sizeof (int)); alloc_aux_for_edge (jump->pred, sizeof (int));
LATCH_EDGE (jump->pred) = 0; LATCH_EDGE (jump->pred) = 0;
set_immediate_dominator (CDI_DOMINATORS, jump, jump->pred->src);
} }
/* A callback for make_forwarder block, to redirect all edges except for /* A callback for make_forwarder block, to redirect all edges except for
...@@ -606,9 +607,6 @@ canonicalize_loop_headers (void) ...@@ -606,9 +607,6 @@ canonicalize_loop_headers (void)
basic_block header; basic_block header;
edge e; edge e;
/* Compute the dominators. */
calculate_dominance_info (CDI_DOMINATORS);
alloc_aux_for_blocks (sizeof (int)); alloc_aux_for_blocks (sizeof (int));
alloc_aux_for_edges (sizeof (int)); alloc_aux_for_edges (sizeof (int));
...@@ -638,8 +636,6 @@ canonicalize_loop_headers (void) ...@@ -638,8 +636,6 @@ canonicalize_loop_headers (void)
HEADER_BLOCK (header) = num_latches; HEADER_BLOCK (header) = num_latches;
} }
free_dominance_info (CDI_DOMINATORS);
if (HEADER_BLOCK (ENTRY_BLOCK_PTR->succ->dest)) if (HEADER_BLOCK (ENTRY_BLOCK_PTR->succ->dest))
{ {
basic_block bb; basic_block bb;
...@@ -711,6 +707,10 @@ canonicalize_loop_headers (void) ...@@ -711,6 +707,10 @@ canonicalize_loop_headers (void)
free_aux_for_blocks (); free_aux_for_blocks ();
free_aux_for_edges (); free_aux_for_edges ();
#ifdef ENABLE_CHECKING
verify_dominators (CDI_DOMINATORS);
#endif
} }
/* Find all the natural loops in the function and save in LOOPS structure and /* Find all the natural loops in the function and save in LOOPS structure and
...@@ -747,12 +747,12 @@ flow_loops_find (struct loops *loops, int flags) ...@@ -747,12 +747,12 @@ flow_loops_find (struct loops *loops, int flags)
dfs_order = NULL; dfs_order = NULL;
rc_order = NULL; rc_order = NULL;
/* Ensure that the dominators are computed. */
calculate_dominance_info (CDI_DOMINATORS);
/* Join loops with shared headers. */ /* Join loops with shared headers. */
canonicalize_loop_headers (); canonicalize_loop_headers ();
/* Compute the dominators. */
calculate_dominance_info (CDI_DOMINATORS);
/* Count the number of loop headers. This should be the /* Count the number of loop headers. This should be the
same as the number of natural loops. */ same as the number of natural loops. */
headers = sbitmap_alloc (last_basic_block); headers = sbitmap_alloc (last_basic_block);
...@@ -880,10 +880,6 @@ flow_loops_find (struct loops *loops, int flags) ...@@ -880,10 +880,6 @@ flow_loops_find (struct loops *loops, int flags)
loops->num = num_loops; loops->num = num_loops;
} }
else
{
free_dominance_info (CDI_DOMINATORS);
}
sbitmap_free (headers); sbitmap_free (headers);
......
...@@ -824,6 +824,20 @@ verify_dominators (enum cdi_direction dir) ...@@ -824,6 +824,20 @@ verify_dominators (enum cdi_direction dir)
err = 1; err = 1;
} }
} }
if (dir == CDI_DOMINATORS
&& dom_computed[dir] >= DOM_NO_FAST_QUERY)
{
FOR_EACH_BB (bb)
{
if (!dominated_by_p (dir, bb, ENTRY_BLOCK_PTR))
{
error ("ENTRY does not dominate bb %d", bb->index);
err = 1;
}
}
}
if (err) if (err)
abort (); abort ();
} }
...@@ -846,6 +860,11 @@ recount_dominator (enum cdi_direction dir, basic_block bb) ...@@ -846,6 +860,11 @@ recount_dominator (enum cdi_direction dir, basic_block bb)
{ {
for (e = bb->pred; e; e = e->pred_next) for (e = bb->pred; e; e = e->pred_next)
{ {
/* Ignore the predecessors that either are not reachable from
the entry block, or whose dominator was not determined yet. */
if (!dominated_by_p (dir, e->src, ENTRY_BLOCK_PTR))
continue;
if (!dominated_by_p (dir, e->src, bb)) if (!dominated_by_p (dir, e->src, bb))
dom_bb = nearest_common_dominator (dir, dom_bb, e->src); dom_bb = nearest_common_dominator (dir, dom_bb, e->src);
} }
...@@ -873,6 +892,9 @@ iterate_fix_dominators (enum cdi_direction dir, basic_block *bbs, int n) ...@@ -873,6 +892,9 @@ iterate_fix_dominators (enum cdi_direction dir, basic_block *bbs, int n)
if (!dom_computed[dir]) if (!dom_computed[dir])
abort (); abort ();
for (i = 0; i < n; i++)
set_immediate_dominator (dir, bbs[i], NULL);
while (changed) while (changed)
{ {
changed = 0; changed = 0;
...@@ -887,6 +909,10 @@ iterate_fix_dominators (enum cdi_direction dir, basic_block *bbs, int n) ...@@ -887,6 +909,10 @@ iterate_fix_dominators (enum cdi_direction dir, basic_block *bbs, int n)
} }
} }
} }
for (i = 0; i < n; i++)
if (!get_immediate_dominator (dir, bbs[i]))
abort ();
} }
void void
......
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