summaryrefslogtreecommitdiff
path: root/gcc/ssa-dce.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ssa-dce.c')
-rw-r--r--gcc/ssa-dce.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/gcc/ssa-dce.c b/gcc/ssa-dce.c
index 45dcd659f00..8bd5e09be65 100644
--- a/gcc/ssa-dce.c
+++ b/gcc/ssa-dce.c
@@ -153,7 +153,7 @@ static void delete_insn_bb
/* Create a control_dependent_block_to_edge_map, given the number
NUM_BASIC_BLOCKS of non-entry, non-exit basic blocks, e.g.,
- n_basic_blocks. This memory must be released using
+ num_basic_blocks. This memory must be released using
control_dependent_block_to_edge_map_free (). */
static control_dependent_block_to_edge_map
@@ -181,10 +181,10 @@ set_control_dependent_block_to_edge_map_bit (c, bb, edge_index)
basic_block bb;
int edge_index;
{
- if (bb->index - (INVALID_BLOCK+1) >= c->length)
+ if (bb->sindex - (INVALID_BLOCK+1) >= c->length)
abort ();
- bitmap_set_bit (c->data[bb->index - (INVALID_BLOCK+1)],
+ bitmap_set_bit (c->data[bb->sindex - (INVALID_BLOCK+1)],
edge_index);
}
@@ -247,7 +247,7 @@ find_control_dependence (el, edge_index, pdom, cdbte)
abort ();
ending_block =
(INDEX_EDGE_PRED_BB (el, edge_index) == ENTRY_BLOCK_PTR)
- ? BASIC_BLOCK (0)
+ ? ENTRY_BLOCK_PTR->next_bb
: find_pdom (pdom, INDEX_EDGE_PRED_BB (el, edge_index));
for (current_block = INDEX_EDGE_SUCC_BB (el, edge_index);
@@ -271,15 +271,15 @@ find_pdom (pdom, block)
{
if (!block)
abort ();
- if (block->index == INVALID_BLOCK)
+ if (block->sindex == INVALID_BLOCK)
abort ();
if (block == ENTRY_BLOCK_PTR)
- return BASIC_BLOCK (0);
- else if (block == EXIT_BLOCK_PTR || pdom[block->index] == EXIT_BLOCK)
+ return ENTRY_BLOCK_PTR->next_bb;
+ else if (block == EXIT_BLOCK_PTR || pdom[block->sindex] == EXIT_BLOCK)
return EXIT_BLOCK_PTR;
else
- return BASIC_BLOCK (pdom[block->index]);
+ return BASIC_BLOCK (pdom[block->sindex]);
}
/* Determine if the given CURRENT_RTX uses a hard register not
@@ -490,6 +490,7 @@ ssa_eliminate_dead_code ()
{
int i;
rtx insn;
+ basic_block bb;
/* Necessary instructions with operands to explore. */
varray_type unprocessed_instructions;
/* Map element (b,e) is nonzero if the block is control dependent on
@@ -505,7 +506,7 @@ ssa_eliminate_dead_code ()
mark_all_insn_unnecessary ();
VARRAY_RTX_INIT (unprocessed_instructions, 64,
"unprocessed instructions");
- cdbte = control_dependent_block_to_edge_map_create (n_basic_blocks);
+ cdbte = control_dependent_block_to_edge_map_create (last_basic_block);
/* Prepare for use of BLOCK_NUM (). */
connect_infinite_loops_to_exit ();
@@ -513,12 +514,12 @@ ssa_eliminate_dead_code ()
compute_bb_for_insn (max_insn_uid);
/* Compute control dependence. */
- pdom = (int *) xmalloc (n_basic_blocks * sizeof (int));
- for (i = 0; i < n_basic_blocks; ++i)
+ pdom = (int *) xmalloc (last_basic_block * sizeof (int));
+ for (i = 0; i < last_basic_block; ++i)
pdom[i] = INVALID_BLOCK;
calculate_dominance_info (pdom, NULL, CDI_POST_DOMINATORS);
/* Assume there is a path from each node to the exit block. */
- for (i = 0; i < n_basic_blocks; ++i)
+ for (i = 0; i < last_basic_block; ++i)
if (pdom[i] == INVALID_BLOCK)
pdom[i] = EXIT_BLOCK;
el = create_edge_list ();
@@ -718,10 +719,8 @@ ssa_eliminate_dead_code ()
/* Find any blocks with no successors and ensure they are followed
by a BARRIER. delete_insn has the nasty habit of deleting barriers
when deleting insns. */
- for (i = 0; i < n_basic_blocks; i++)
+ FOR_ALL_BB (bb)
{
- basic_block bb = BASIC_BLOCK (i);
-
if (bb->succ == NULL)
{
rtx next = NEXT_INSN (bb->end);