Commit cc360b36 by Steven Bosscher

graphite-scop-detection.c (create_sese_edges): Compute dominance info before…

graphite-scop-detection.c (create_sese_edges): Compute dominance info before trying to fix loop structure.

	* graphite-scop-detection.c (create_sese_edges): Compute dominance
	info before trying to fix loop structure.
	* cfgloopmanip.c (fix_loop_structure): Require fast DOM queries.
	* tree-cfgcleanup.c (repair_loop_structures): Likewise.
	* cfgloop.c (verify_loop_structure): Verify loop fathers.

From-SVN: r190390
parent 2ba31c05
2012-08-14 Steven Bosscher <steven@gcc.gnu.org> 2012-08-14 Steven Bosscher <steven@gcc.gnu.org>
* graphite-scop-detection.c (create_sese_edges): Compute dominance
info before trying to fix loop structure.
* cfgloopmanip.c (fix_loop_structure): Require fast DOM queries.
* tree-cfgcleanup.c (repair_loop_structures): Likewise.
* cfgloop.c (verify_loop_structure): Verify loop fathers.
* dominance.c (init_dom_info): Use gcc_checking_assert, not gcc_assert. * dominance.c (init_dom_info): Use gcc_checking_assert, not gcc_assert.
(dom_convert_dir_to_idx, compute_dom_fast_query, (dom_convert_dir_to_idx, compute_dom_fast_query,
get_immediate_dominator, set_immediate_dominator, get_dominated_by, get_immediate_dominator, set_immediate_dominator, get_dominated_by,
......
...@@ -1294,6 +1294,7 @@ cancel_loop_tree (struct loop *loop) ...@@ -1294,6 +1294,7 @@ cancel_loop_tree (struct loop *loop)
-- loop header have just single entry edge and single latch edge -- loop header have just single entry edge and single latch edge
-- loop latches have only single successor that is header of their loop -- loop latches have only single successor that is header of their loop
-- irreducible loops are correctly marked -- irreducible loops are correctly marked
-- the cached loop depth and loop father of each bb is correct
*/ */
DEBUG_FUNCTION void DEBUG_FUNCTION void
verify_loop_structure (void) verify_loop_structure (void)
...@@ -1308,6 +1309,7 @@ verify_loop_structure (void) ...@@ -1308,6 +1309,7 @@ verify_loop_structure (void)
loop_iterator li; loop_iterator li;
struct loop_exit *exit, *mexit; struct loop_exit *exit, *mexit;
bool dom_available = dom_info_available_p (CDI_DOMINATORS); bool dom_available = dom_info_available_p (CDI_DOMINATORS);
sbitmap visited = sbitmap_alloc (last_basic_block);
/* We need up-to-date dominators, compute or verify them. */ /* We need up-to-date dominators, compute or verify them. */
if (!dom_available) if (!dom_available)
...@@ -1349,6 +1351,29 @@ verify_loop_structure (void) ...@@ -1349,6 +1351,29 @@ verify_loop_structure (void)
} }
free (bbs); free (bbs);
} }
sbitmap_zero (visited);
FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
{
bbs = get_loop_body (loop);
for (j = 0; j < loop->num_nodes; j++)
{
bb = bbs[j];
/* Ignore this block if it is in an inner loop. */
if (TEST_BIT (visited, bb->index))
continue;
SET_BIT (visited, bb->index);
if (bb->loop_father != loop)
{
error ("bb %d has father loop %d, should be loop %d",
bb->index, bb->loop_father->num, loop->num);
err = 1;
}
}
free (bbs);
}
/* Check headers and latches. */ /* Check headers and latches. */
FOR_EACH_LOOP (li, loop, 0) FOR_EACH_LOOP (li, loop, 0)
...@@ -1556,6 +1581,7 @@ verify_loop_structure (void) ...@@ -1556,6 +1581,7 @@ verify_loop_structure (void)
gcc_assert (!err); gcc_assert (!err);
sbitmap_free (visited);
free (sizes); free (sizes);
if (!dom_available) if (!dom_available)
free_dominance_info (CDI_DOMINATORS); free_dominance_info (CDI_DOMINATORS);
......
...@@ -1640,6 +1640,9 @@ fix_loop_structure (bitmap changed_bbs) ...@@ -1640,6 +1640,9 @@ fix_loop_structure (bitmap changed_bbs)
bool record_exits = false; bool record_exits = false;
struct loop **superloop = XNEWVEC (struct loop *, number_of_loops ()); struct loop **superloop = XNEWVEC (struct loop *, number_of_loops ());
/* We need exact and fast dominance info to be available. */
gcc_assert (dom_info_state (CDI_DOMINATORS) == DOM_OK);
/* Remove the old bb -> loop mapping. Remember the depth of the blocks in /* Remove the old bb -> loop mapping. Remember the depth of the blocks in
the loop hierarchy, so that we can recognize blocks whose loop nesting the loop hierarchy, so that we can recognize blocks whose loop nesting
relationship has changed. */ relationship has changed. */
......
...@@ -1029,6 +1029,7 @@ create_sese_edges (VEC (sd_region, heap) *regions) ...@@ -1029,6 +1029,7 @@ create_sese_edges (VEC (sd_region, heap) *regions)
unmark_exit_edges (regions); unmark_exit_edges (regions);
calculate_dominance_info (CDI_DOMINATORS);
fix_loop_structure (NULL); fix_loop_structure (NULL);
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
......
...@@ -737,6 +737,8 @@ repair_loop_structures (void) ...@@ -737,6 +737,8 @@ repair_loop_structures (void)
{ {
bitmap changed_bbs; bitmap changed_bbs;
calculate_dominance_info (CDI_DOMINATORS);
timevar_push (TV_REPAIR_LOOPS); timevar_push (TV_REPAIR_LOOPS);
changed_bbs = BITMAP_ALLOC (NULL); changed_bbs = BITMAP_ALLOC (NULL);
fix_loop_structure (changed_bbs); fix_loop_structure (changed_bbs);
......
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