Commit c33bae88 by Steven Bosscher Committed by Steven Bosscher

re PR tree-optimization/19876 (g++ starts eating all the memory and the CPU)

	PR tree-optimization/19876
	Partially revert my change from 2005-01-14
	* tree-ssa-pre.c (compute_antic_aux): Make recursive once again...
	(compute_antic): ...and remove the loop here.

From-SVN: r94896
parent 36b23fd7
2005-02-11 Steven Bosscher <stevenb@suse.de>
PR tree-optimization/19876
Partially revert my change from 2005-01-14
* tree-ssa-pre.c (compute_antic_aux): Make recursive once again...
(compute_antic): ...and remove the loop here.
2005-02-11 Jakub Jelinek <jakub@redhat.com> 2005-02-11 Jakub Jelinek <jakub@redhat.com>
PR middle-end/19858 PR middle-end/19858
......
...@@ -1103,6 +1103,7 @@ clean (value_set_t set) ...@@ -1103,6 +1103,7 @@ clean (value_set_t set)
} }
DEF_VEC_MALLOC_P (basic_block); DEF_VEC_MALLOC_P (basic_block);
sbitmap has_abnormal_preds;
/* Compute the ANTIC set for BLOCK. /* Compute the ANTIC set for BLOCK.
...@@ -1121,6 +1122,7 @@ DEF_VEC_MALLOC_P (basic_block); ...@@ -1121,6 +1122,7 @@ DEF_VEC_MALLOC_P (basic_block);
static bool static bool
compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge) compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
{ {
basic_block son;
bool changed = false; bool changed = false;
value_set_t S, old, ANTIC_OUT; value_set_t S, old, ANTIC_OUT;
value_set_node_t node; value_set_node_t node;
...@@ -1185,7 +1187,7 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge) ...@@ -1185,7 +1187,7 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
ANTIC_IN (block) = bitmap_set_subtract_from_value_set (EXP_GEN (block), ANTIC_IN (block) = bitmap_set_subtract_from_value_set (EXP_GEN (block),
TMP_GEN (block), TMP_GEN (block),
true); true);
/* Then union in the ANTIC_OUT - TMP_GEN values, /* Then union in the ANTIC_OUT - TMP_GEN values,
to get ANTIC_OUT U EXP_GEN - TMP_GEN */ to get ANTIC_OUT U EXP_GEN - TMP_GEN */
for (node = S->head; node; node = node->next) for (node = S->head; node; node = node->next)
...@@ -1205,19 +1207,24 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge) ...@@ -1205,19 +1207,24 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
print_value_set (dump_file, S, "S", block->index); print_value_set (dump_file, S, "S", block->index);
} }
for (son = first_dom_son (CDI_POST_DOMINATORS, block);
son;
son = next_dom_son (CDI_POST_DOMINATORS, son))
{
changed |= compute_antic_aux (son,
TEST_BIT (has_abnormal_preds, son->index));
}
return changed; return changed;
} }
/* Compute ANTIC sets. Iterates until fixpointed. */ /* Compute ANTIC sets. */
static void static void
compute_antic (void) compute_antic (void)
{ {
bool changed= true; bool changed = true;
int num_iterations = 0; int num_iterations = 0;
basic_block block, *worklist; basic_block block;
size_t sp = 0;
sbitmap has_abnormal_preds;
/* If any predecessor edges are abnormal, we punt, so antic_in is empty. /* If any predecessor edges are abnormal, we punt, so antic_in is empty.
We pre-build the map of blocks with incoming abnormal edges here. */ We pre-build the map of blocks with incoming abnormal edges here. */
...@@ -1229,11 +1236,11 @@ compute_antic (void) ...@@ -1229,11 +1236,11 @@ compute_antic (void)
edge e; edge e;
FOR_EACH_EDGE (e, ei, block->preds) FOR_EACH_EDGE (e, ei, block->preds)
if (e->flags & EDGE_ABNORMAL) if (e->flags & EDGE_ABNORMAL)
{ {
SET_BIT (has_abnormal_preds, block->index); SET_BIT (has_abnormal_preds, block->index);
break; break;
} }
/* While we are here, give empty ANTIC_IN sets to each block. */ /* While we are here, give empty ANTIC_IN sets to each block. */
ANTIC_IN (block) = set_new (true); ANTIC_IN (block) = set_new (true);
...@@ -1241,41 +1248,13 @@ compute_antic (void) ...@@ -1241,41 +1248,13 @@ compute_antic (void)
/* At the exit block we anticipate nothing. */ /* At the exit block we anticipate nothing. */
ANTIC_IN (EXIT_BLOCK_PTR) = set_new (true); ANTIC_IN (EXIT_BLOCK_PTR) = set_new (true);
/* Allocate the worklist. */
worklist = xmalloc (sizeof (basic_block) * n_basic_blocks);
/* Loop until fixpointed. */
while (changed) while (changed)
{ {
basic_block son, bb;
changed = false;
num_iterations++; num_iterations++;
changed = false;
/* Seed the algorithm by putting post-dominator children of changed = compute_antic_aux (EXIT_BLOCK_PTR, false);
the exit block in the worklist. */
for (son = first_dom_son (CDI_POST_DOMINATORS, EXIT_BLOCK_PTR);
son;
son = next_dom_son (CDI_POST_DOMINATORS, son))
worklist[sp++] = son;
/* Now visit all blocks in a DFS of the post dominator tree. */
while (sp)
{
bool bb_has_abnormal_pred;
bb = worklist[--sp];
bb_has_abnormal_pred = TEST_BIT (has_abnormal_preds, bb->index);
changed |= compute_antic_aux (bb, bb_has_abnormal_pred);
for (son = first_dom_son (CDI_POST_DOMINATORS, bb);
son;
son = next_dom_son (CDI_POST_DOMINATORS, son))
worklist[sp++] = son;
}
} }
free (worklist);
sbitmap_free (has_abnormal_preds); sbitmap_free (has_abnormal_preds);
if (dump_file && (dump_flags & TDF_STATS)) if (dump_file && (dump_flags & TDF_STATS))
......
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