summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dce.c
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-14 18:40:30 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-14 18:40:30 +0000
commite0e865f0d6671390cd0f4e850e207c01768c8660 (patch)
treea22f0af11a0134a6fea37711e4f1ff20133eb8b6 /gcc/tree-ssa-dce.c
parent32f2c8ec4a9e2056720d94d81624bf6975ef7221 (diff)
downloadgcc-e0e865f0d6671390cd0f4e850e207c01768c8660.tar.gz
* tree-ssa-dce.c (visited_control_parents): New sbitmap to
replace BB_VISITED uses. (find_obviously_necessary_stmts): Don't clear BB_VISITED. (propagate_necessity): Check the bitmap instead of BB_VISITED. (tree_dce_done): Free visited_control_parents. (perform_tree_ssa_dce): Allocate and clear it. * tree-ssa-pre.c (compute_antic_aux): Make non-recursive. (compute_antic): Iterate from here using a DFS. Use an sbitmap instead of BB_VISITED. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@93654 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-dce.c')
-rw-r--r--gcc/tree-ssa-dce.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index f37430d3299..4f72d82f92c 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -93,6 +93,10 @@ static sbitmap last_stmt_necessary;
on the Ith edge. */
bitmap *control_dependence_map;
+/* Vector indicating that a basic block has already had all the edges
+ processed that it is control dependent on. */
+sbitmap visited_control_parents;
+
/* Execute CODE for each edge (given number EDGE_NUMBER within the CODE)
for which the block with index N is control dependent. */
#define EXECUTE_IF_CONTROL_DEPENDENT(N, EDGE_NUMBER, CODE) \
@@ -482,11 +486,6 @@ find_obviously_necessary_stmts (struct edge_list *el)
NECESSARY (stmt) = 0;
mark_stmt_if_obviously_necessary (stmt, el != NULL);
}
-
- /* Mark this basic block as `not visited'. A block will be marked
- visited when the edges that it is control dependent on have been
- marked. */
- bb->flags &= ~BB_VISITED;
}
if (el)
@@ -565,9 +564,10 @@ propagate_necessity (struct edge_list *el)
containing `i' is control dependent on, but only if we haven't
already done so. */
basic_block bb = bb_for_stmt (i);
- if (! (bb->flags & BB_VISITED))
+ if (bb != ENTRY_BLOCK_PTR
+ && ! TEST_BIT (visited_control_parents, bb->index))
{
- bb->flags |= BB_VISITED;
+ SET_BIT (visited_control_parents, bb->index);
mark_control_dependent_edges_necessary (bb, el);
}
}
@@ -593,9 +593,10 @@ propagate_necessity (struct edge_list *el)
for (k = 0; k < PHI_NUM_ARGS (i); k++)
{
basic_block arg_bb = PHI_ARG_EDGE (i, k)->src;
- if (! (arg_bb->flags & BB_VISITED))
+ if (arg_bb != ENTRY_BLOCK_PTR
+ && ! TEST_BIT (visited_control_parents, arg_bb->index))
{
- arg_bb->flags |= BB_VISITED;
+ SET_BIT (visited_control_parents, arg_bb->index);
mark_control_dependent_edges_necessary (arg_bb, el);
}
}
@@ -903,6 +904,7 @@ tree_dce_done (bool aggressive)
BITMAP_XFREE (control_dependence_map[i]);
free (control_dependence_map);
+ sbitmap_free (visited_control_parents);
sbitmap_free (last_stmt_necessary);
}
@@ -939,6 +941,9 @@ perform_tree_ssa_dce (bool aggressive)
find_all_control_dependences (el);
timevar_pop (TV_CONTROL_DEPENDENCES);
+ visited_control_parents = sbitmap_alloc (last_basic_block);
+ sbitmap_zero (visited_control_parents);
+
mark_dfs_back_edges ();
}