Commit bf77398c by Zdenek Dvorak Committed by Zdenek Dvorak

basic-block.h (last_basic_block): Declare.

	* basic-block.h (last_basic_block): Declare.
	(expunge_block_nocompact): Declaration removed.
	(compact_blocks): Declare.
	* cfg.c (last_basic_block): New variable.
	(expunge_block_nocompact): Removed.
	(expunge_block): Do not compact basic blocks.
	(compact_blocks): New.
	* cfganal.c (flow_call_edges_add): Use the fact that bb indices no
	longer change.
	* cfgbuild.c (find_basic_blocks_1, find_basic_blocks): Set
	last_basic_block.
	* cfgcleanup.c (merge_blocks_move_predecessor_nojumps): Do not change
	real positions of blocks.
	(delete_unreachable_blocks): Simplified -- quadratic behavior now
	cannot occur.
	(cleanup_cfg): Compact blocks.
	* cfgrtl.c (create_basic_block): Insert basic blocks to the end of
	basic_block_info varray.
	(flow_delete_block): Comment update.
	(back_edge_of_syntactic_loop_p): Modify position check code.
	(verify_flow_info): Update checking.
	* flow.c (calculate_global_regs_live): Use FOR_EACH_BB.
	* ifcvt.c (SET_ORIG_INDEX, ORIG_INDEX): Removed.
	(find_if_case_1, find_if_case_2, if_convert): Use the fact that bb
	indices no longer change.
	* lcm.c (optimize_mode_switching): Replace n_basic_blocks with
	last_basic_block.
	* predict.c (estimate_bb_frequencies): Remove unneccessary code.
	* profile.c (branch_prob): Compact blocks.
	* sched-rgn.c (find_rgns): Replace n_basic_blocks with
	last_basic_block.

From-SVN: r53957
parent ae12a094
2002-05-28 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* basic-block.h (last_basic_block): Declare.
(expunge_block_nocompact): Declaration removed.
(compact_blocks): Declare.
* cfg.c (last_basic_block): New variable.
(expunge_block_nocompact): Removed.
(expunge_block): Do not compact basic blocks.
(compact_blocks): New.
* cfganal.c (flow_call_edges_add): Use the fact that bb indices no
longer change.
* cfgbuild.c (find_basic_blocks_1, find_basic_blocks): Set
last_basic_block.
* cfgcleanup.c (merge_blocks_move_predecessor_nojumps): Do not change
real positions of blocks.
(delete_unreachable_blocks): Simplified -- quadratic behavior now
cannot occur.
(cleanup_cfg): Compact blocks.
* cfgrtl.c (create_basic_block): Insert basic blocks to the end of
basic_block_info varray.
(flow_delete_block): Comment update.
(back_edge_of_syntactic_loop_p): Modify position check code.
(verify_flow_info): Update checking.
* flow.c (calculate_global_regs_live): Use FOR_EACH_BB.
* ifcvt.c (SET_ORIG_INDEX, ORIG_INDEX): Removed.
(find_if_case_1, find_if_case_2, if_convert): Use the fact that bb
indices no longer change.
* lcm.c (optimize_mode_switching): Replace n_basic_blocks with
last_basic_block.
* predict.c (estimate_bb_frequencies): Remove unneccessary code.
* profile.c (branch_prob): Compact blocks.
* sched-rgn.c (find_rgns): Replace n_basic_blocks with
last_basic_block.
2002-05-28 Kazu Hirata <kazu@cs.umass.edu> 2002-05-28 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/h8300.md (two anonymous patterns): New. * config/h8300/h8300.md (two anonymous patterns): New.
......
...@@ -235,7 +235,7 @@ extern int n_basic_blocks; ...@@ -235,7 +235,7 @@ extern int n_basic_blocks;
/* First free basic block number. */ /* First free basic block number. */
#define last_basic_block n_basic_blocks extern int last_basic_block;
/* Number of edges in the current function. */ /* Number of edges in the current function. */
...@@ -670,7 +670,7 @@ extern void allocate_bb_life_data PARAMS ((void)); ...@@ -670,7 +670,7 @@ extern void allocate_bb_life_data PARAMS ((void));
extern void expunge_block PARAMS ((basic_block)); extern void expunge_block PARAMS ((basic_block));
extern void link_block PARAMS ((basic_block, basic_block)); extern void link_block PARAMS ((basic_block, basic_block));
extern void unlink_block PARAMS ((basic_block)); extern void unlink_block PARAMS ((basic_block));
extern void expunge_block_nocompact PARAMS ((basic_block)); extern void compact_blocks PARAMS ((void));
extern basic_block alloc_block PARAMS ((void)); extern basic_block alloc_block PARAMS ((void));
extern void find_unreachable_blocks PARAMS ((void)); extern void find_unreachable_blocks PARAMS ((void));
extern int delete_noop_moves PARAMS ((rtx)); extern int delete_noop_moves PARAMS ((rtx));
......
...@@ -65,6 +65,10 @@ static char *flow_firstobj; ...@@ -65,6 +65,10 @@ static char *flow_firstobj;
int n_basic_blocks; int n_basic_blocks;
/* First free basic block number. */
int last_basic_block;
/* Number of edges in the current function. */ /* Number of edges in the current function. */
int n_edges; int n_edges;
...@@ -243,14 +247,37 @@ unlink_block (b) ...@@ -243,14 +247,37 @@ unlink_block (b)
b->prev_bb->next_bb = b->next_bb; b->prev_bb->next_bb = b->next_bb;
} }
/* Sequentially order blocks and compact the arrays. */
void
compact_blocks ()
{
int i;
basic_block bb;
i = 0;
FOR_EACH_BB (bb)
{
BASIC_BLOCK (i) = bb;
bb->index = i;
i++;
}
if (i != n_basic_blocks)
abort ();
last_basic_block = n_basic_blocks;
}
/* Remove block B from the basic block array and compact behind it. */ /* Remove block B from the basic block array. */
void void
expunge_block_nocompact (b) expunge_block (b)
basic_block b; basic_block b;
{ {
unlink_block (b); unlink_block (b);
BASIC_BLOCK (b->index) = NULL;
n_basic_blocks--;
/* Invalidate data to make bughunting easier. */ /* Invalidate data to make bughunting easier. */
memset (b, 0, sizeof *b); memset (b, 0, sizeof *b);
...@@ -258,25 +285,6 @@ expunge_block_nocompact (b) ...@@ -258,25 +285,6 @@ expunge_block_nocompact (b)
b->succ = (edge) first_deleted_block; b->succ = (edge) first_deleted_block;
first_deleted_block = (basic_block) b; first_deleted_block = (basic_block) b;
} }
void
expunge_block (b)
basic_block b;
{
int i, n = n_basic_blocks;
for (i = b->index; i + 1 < n; ++i)
{
basic_block x = BASIC_BLOCK (i + 1);
BASIC_BLOCK (i) = x;
x->index = i;
}
n_basic_blocks--;
basic_block_info->num_elements--;
expunge_block_nocompact (b);
}
/* Create an edge connecting SRC and DST with FLAGS optionally using /* Create an edge connecting SRC and DST with FLAGS optionally using
edge cache CACHE. Return the new edge, NULL if already exist. */ edge cache CACHE. Return the new edge, NULL if already exist. */
......
...@@ -258,29 +258,16 @@ flow_call_edges_add (blocks) ...@@ -258,29 +258,16 @@ flow_call_edges_add (blocks)
{ {
int i; int i;
int blocks_split = 0; int blocks_split = 0;
int bb_num = 0; int last_bb = last_basic_block;
basic_block *bbs, bb;
bool check_last_block = false; bool check_last_block = false;
/* Map bb indices into basic block pointers since split_block if (n_basic_blocks == 0)
will renumber the basic blocks. */ return 0;
bbs = xmalloc (n_basic_blocks * sizeof (*bbs));
if (! blocks) if (! blocks)
{ check_last_block = true;
FOR_EACH_BB (bb)
bbs[bb_num++] = bb;
check_last_block = true;
}
else else
EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i, check_last_block = TEST_BIT (blocks, EXIT_BLOCK_PTR->prev_bb->index);
{
bbs[bb_num++] = BASIC_BLOCK (i);
if (i == n_basic_blocks - 1)
check_last_block = true;
});
/* In the last basic block, before epilogue generation, there will be /* In the last basic block, before epilogue generation, there will be
a fallthru edge to EXIT. Special care is required if the last insn a fallthru edge to EXIT. Special care is required if the last insn
...@@ -321,12 +308,18 @@ flow_call_edges_add (blocks) ...@@ -321,12 +308,18 @@ flow_call_edges_add (blocks)
calls since there is no way that we can determine if they will calls since there is no way that we can determine if they will
return or not... */ return or not... */
for (i = 0; i < bb_num; i++) for (i = 0; i < last_bb; i++)
{ {
basic_block bb = bbs[i]; basic_block bb = BASIC_BLOCK (i);
rtx insn; rtx insn;
rtx prev_insn; rtx prev_insn;
if (!bb)
continue;
if (blocks && !TEST_BIT (blocks, i))
continue;
for (insn = bb->end; ; insn = prev_insn) for (insn = bb->end; ; insn = prev_insn)
{ {
prev_insn = PREV_INSN (insn); prev_insn = PREV_INSN (insn);
...@@ -374,7 +367,6 @@ flow_call_edges_add (blocks) ...@@ -374,7 +367,6 @@ flow_call_edges_add (blocks)
if (blocks_split) if (blocks_split)
verify_flow_info (); verify_flow_info ();
free (bbs);
return blocks_split; return blocks_split;
} }
...@@ -927,7 +919,7 @@ flow_preorder_transversal_compute (pot_order) ...@@ -927,7 +919,7 @@ flow_preorder_transversal_compute (pot_order)
for (e = bb->succ; e; e = e->succ_next) for (e = bb->succ; e; e = e->succ_next)
max_successors++; max_successors++;
dfst[i].node dfst[bb->index].node
= (max_successors = (max_successors
? (struct dfst_node **) xcalloc (max_successors, ? (struct dfst_node **) xcalloc (max_successors,
sizeof (struct dfst_node *)) sizeof (struct dfst_node *))
......
...@@ -471,7 +471,6 @@ find_basic_blocks_1 (f) ...@@ -471,7 +471,6 @@ find_basic_blocks_1 (f)
rtx f; rtx f;
{ {
rtx insn, next; rtx insn, next;
int i = 0;
rtx bb_note = NULL_RTX; rtx bb_note = NULL_RTX;
rtx lvl = NULL_RTX; rtx lvl = NULL_RTX;
rtx trll = NULL_RTX; rtx trll = NULL_RTX;
...@@ -494,7 +493,7 @@ find_basic_blocks_1 (f) ...@@ -494,7 +493,7 @@ find_basic_blocks_1 (f)
if ((GET_CODE (insn) == CODE_LABEL || GET_CODE (insn) == BARRIER) if ((GET_CODE (insn) == CODE_LABEL || GET_CODE (insn) == BARRIER)
&& head) && head)
{ {
prev = create_basic_block_structure (i++, head, end, bb_note, prev); prev = create_basic_block_structure (last_basic_block++, head, end, bb_note, prev);
head = end = NULL_RTX; head = end = NULL_RTX;
bb_note = NULL_RTX; bb_note = NULL_RTX;
} }
...@@ -508,7 +507,7 @@ find_basic_blocks_1 (f) ...@@ -508,7 +507,7 @@ find_basic_blocks_1 (f)
if (head && control_flow_insn_p (insn)) if (head && control_flow_insn_p (insn))
{ {
prev = create_basic_block_structure (i++, head, end, bb_note, prev); prev = create_basic_block_structure (last_basic_block++, head, end, bb_note, prev);
head = end = NULL_RTX; head = end = NULL_RTX;
bb_note = NULL_RTX; bb_note = NULL_RTX;
} }
...@@ -590,11 +589,11 @@ find_basic_blocks_1 (f) ...@@ -590,11 +589,11 @@ find_basic_blocks_1 (f)
} }
if (head != NULL_RTX) if (head != NULL_RTX)
create_basic_block_structure (i++, head, end, bb_note, prev); create_basic_block_structure (last_basic_block++, head, end, bb_note, prev);
else if (bb_note) else if (bb_note)
delete_insn (bb_note); delete_insn (bb_note);
if (i != n_basic_blocks) if (last_basic_block != n_basic_blocks)
abort (); abort ();
label_value_list = lvl; label_value_list = lvl;
...@@ -635,6 +634,7 @@ find_basic_blocks (f, nregs, file) ...@@ -635,6 +634,7 @@ find_basic_blocks (f, nregs, file)
} }
n_basic_blocks = count_basic_blocks (f); n_basic_blocks = count_basic_blocks (f);
last_basic_block = 0;
ENTRY_BLOCK_PTR->next_bb = EXIT_BLOCK_PTR; ENTRY_BLOCK_PTR->next_bb = EXIT_BLOCK_PTR;
EXIT_BLOCK_PTR->prev_bb = ENTRY_BLOCK_PTR; EXIT_BLOCK_PTR->prev_bb = ENTRY_BLOCK_PTR;
......
...@@ -688,7 +688,6 @@ merge_blocks_move_predecessor_nojumps (a, b) ...@@ -688,7 +688,6 @@ merge_blocks_move_predecessor_nojumps (a, b)
basic_block a, b; basic_block a, b;
{ {
rtx barrier; rtx barrier;
int index;
barrier = next_nonnote_insn (a->end); barrier = next_nonnote_insn (a->end);
if (GET_CODE (barrier) != BARRIER) if (GET_CODE (barrier) != BARRIER)
...@@ -714,14 +713,7 @@ merge_blocks_move_predecessor_nojumps (a, b) ...@@ -714,14 +713,7 @@ merge_blocks_move_predecessor_nojumps (a, b)
fprintf (rtl_dump_file, "Moved block %d before %d and merged.\n", fprintf (rtl_dump_file, "Moved block %d before %d and merged.\n",
a->index, b->index); a->index, b->index);
/* Swap the records for the two blocks around. Although we are deleting B, /* Swap the records for the two blocks around. */
A is now where B was and we want to compact the BB array from where
A used to be. */
BASIC_BLOCK (a->index) = b;
BASIC_BLOCK (b->index) = a;
index = a->index;
a->index = b->index;
b->index = index;
unlink_block (a); unlink_block (a);
link_block (a, b->prev_bb); link_block (a, b->prev_bb);
...@@ -1755,13 +1747,10 @@ delete_unreachable_blocks () ...@@ -1755,13 +1747,10 @@ delete_unreachable_blocks ()
{ {
bool changed = false; bool changed = false;
basic_block b, next_bb; basic_block b, next_bb;
int j = 0;
find_unreachable_blocks (); find_unreachable_blocks ();
/* Delete all unreachable basic blocks. Do compaction concurrently, /* Delete all unreachable basic blocks. */
as otherwise we can wind up with O(N^2) behaviour here when we
have oodles of dead code. */
for (b = ENTRY_BLOCK_PTR->next_bb; b != EXIT_BLOCK_PTR; b = next_bb) for (b = ENTRY_BLOCK_PTR->next_bb; b != EXIT_BLOCK_PTR; b = next_bb)
{ {
...@@ -1769,18 +1758,10 @@ delete_unreachable_blocks () ...@@ -1769,18 +1758,10 @@ delete_unreachable_blocks ()
if (!(b->flags & BB_REACHABLE)) if (!(b->flags & BB_REACHABLE))
{ {
flow_delete_block_noexpunge (b); flow_delete_block (b);
expunge_block_nocompact (b);
changed = true; changed = true;
} }
else
{
BASIC_BLOCK (j) = b;
b->index = j++;
}
} }
n_basic_blocks = j;
basic_block_info->num_elements = j;
if (changed) if (changed)
tidy_fallthru_edges (); tidy_fallthru_edges ();
...@@ -1806,6 +1787,9 @@ cleanup_cfg (mode) ...@@ -1806,6 +1787,9 @@ cleanup_cfg (mode)
&& !reload_completed) && !reload_completed)
delete_trivially_dead_insns (get_insns(), max_reg_num ()); delete_trivially_dead_insns (get_insns(), max_reg_num ());
} }
compact_blocks ();
while (try_optimize_cfg (mode)) while (try_optimize_cfg (mode))
{ {
delete_unreachable_blocks (), changed = true; delete_unreachable_blocks (), changed = true;
......
...@@ -336,22 +336,12 @@ create_basic_block (head, end, after) ...@@ -336,22 +336,12 @@ create_basic_block (head, end, after)
basic_block after; basic_block after;
{ {
basic_block bb; basic_block bb;
int i; int index = last_basic_block++;
int index = after->index + 1;
/* Place the new block just after the block being split. */ /* Place the new block just after the end. */
VARRAY_GROW (basic_block_info, ++n_basic_blocks); VARRAY_GROW (basic_block_info, last_basic_block);
/* Some parts of the compiler expect blocks to be number in n_basic_blocks++;
sequential order so insert the new block immediately after the
block being split.. */
for (i = n_basic_blocks - 1; i > index; --i)
{
basic_block tmp = BASIC_BLOCK (i - 1);
BASIC_BLOCK (i) = tmp;
tmp->index = i;
}
bb = create_basic_block_structure (index, head, end, NULL, after); bb = create_basic_block_structure (index, head, end, NULL, after);
bb->aux = NULL; bb->aux = NULL;
...@@ -435,7 +425,7 @@ flow_delete_block (b) ...@@ -435,7 +425,7 @@ flow_delete_block (b)
{ {
int deleted_handler = flow_delete_block_noexpunge (b); int deleted_handler = flow_delete_block_noexpunge (b);
/* Remove the basic block from the array, and compact behind it. */ /* Remove the basic block from the array. */
expunge_block (b); expunge_block (b);
return deleted_handler; return deleted_handler;
...@@ -1210,12 +1200,19 @@ back_edge_of_syntactic_loop_p (bb1, bb2) ...@@ -1210,12 +1200,19 @@ back_edge_of_syntactic_loop_p (bb1, bb2)
{ {
rtx insn; rtx insn;
int count = 0; int count = 0;
basic_block bb;
if (bb1->index > bb2->index) if (bb1 == bb2)
return false;
else if (bb1->index == bb2->index)
return true; return true;
/* ??? Could we guarantee that bb indices are monotone, so that we could
just compare them? */
for (bb = bb1; bb && bb != bb2; bb = bb->next_bb)
continue;
if (!bb)
return false;
for (insn = bb1->end; insn != bb2->head && count >= 0; for (insn = bb1->end; insn != bb2->head && count >= 0;
insn = NEXT_INSN (insn)) insn = NEXT_INSN (insn))
if (GET_CODE (insn) == NOTE) if (GET_CODE (insn) == NOTE)
...@@ -1708,7 +1705,7 @@ verify_flow_info () ...@@ -1708,7 +1705,7 @@ verify_flow_info ()
basic_block *bb_info, *last_visited; basic_block *bb_info, *last_visited;
size_t *edge_checksum; size_t *edge_checksum;
rtx x; rtx x;
int i, num_bb_notes, err = 0; int num_bb_notes, err = 0;
basic_block bb, last_bb_seen; basic_block bb, last_bb_seen;
bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block)); bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block));
...@@ -1734,21 +1731,6 @@ verify_flow_info () ...@@ -1734,21 +1731,6 @@ verify_flow_info ()
err = 1; err = 1;
} }
/* For now, also check that we didn't change the order. */
if (bb != EXIT_BLOCK_PTR && bb->index != last_bb_seen->index + 1)
{
error ("Wrong order of blocks %d and %d",
last_bb_seen->index, bb->index);
err = 1;
}
if (bb == EXIT_BLOCK_PTR && last_bb_seen->index != n_basic_blocks - 1)
{
error ("Only %d of %d blocks in chain",
last_bb_seen->index + 1, n_basic_blocks);
err = 1;
}
last_bb_seen = bb; last_bb_seen = bb;
} }
...@@ -2065,10 +2047,10 @@ verify_flow_info () ...@@ -2065,10 +2047,10 @@ verify_flow_info ()
edge_checksum[e->dest->index + 2] -= (size_t) e; edge_checksum[e->dest->index + 2] -= (size_t) e;
} }
for (i = -2; i < n_basic_blocks; ++i) FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
if (edge_checksum[i + 2]) if (edge_checksum[bb->index + 2])
{ {
error ("basic block %i edge lists are corrupted", i); error ("basic block %i edge lists are corrupted", bb->index);
err = 1; err = 1;
} }
...@@ -2079,7 +2061,7 @@ verify_flow_info () ...@@ -2079,7 +2061,7 @@ verify_flow_info ()
{ {
if (NOTE_INSN_BASIC_BLOCK_P (x)) if (NOTE_INSN_BASIC_BLOCK_P (x))
{ {
basic_block bb = NOTE_BASIC_BLOCK (x); bb = NOTE_BASIC_BLOCK (x);
num_bb_notes++; num_bb_notes++;
if (bb != last_bb_seen->next_bb) if (bb != last_bb_seen->next_bb)
......
...@@ -1108,9 +1108,8 @@ calculate_global_regs_live (blocks_in, blocks_out, flags) ...@@ -1108,9 +1108,8 @@ calculate_global_regs_live (blocks_in, blocks_out, flags)
} }
else else
{ {
for (i = 0; i < n_basic_blocks; ++i) FOR_EACH_BB (bb)
{ {
basic_block bb = BASIC_BLOCK (i);
*--qhead = bb; *--qhead = bb;
bb->aux = bb; bb->aux = bb;
} }
......
...@@ -111,14 +111,6 @@ static int dead_or_predicable PARAMS ((basic_block, basic_block, ...@@ -111,14 +111,6 @@ static int dead_or_predicable PARAMS ((basic_block, basic_block,
basic_block, basic_block, int)); basic_block, basic_block, int));
static void noce_emit_move_insn PARAMS ((rtx, rtx)); static void noce_emit_move_insn PARAMS ((rtx, rtx));
/* Abuse the basic_block AUX field to store the original block index,
as well as a flag indicating that the block should be rescaned for
life analysis. */
#define SET_ORIG_INDEX(BB,I) ((BB)->aux = (void *)((size_t)(I)))
#define ORIG_INDEX(BB) ((size_t)(BB)->aux)
/* Count the number of non-jump active insns in BB. */ /* Count the number of non-jump active insns in BB. */
static int static int
...@@ -2279,6 +2271,7 @@ find_if_case_1 (test_bb, then_edge, else_edge) ...@@ -2279,6 +2271,7 @@ find_if_case_1 (test_bb, then_edge, else_edge)
basic_block then_bb = then_edge->dest; basic_block then_bb = then_edge->dest;
basic_block else_bb = else_edge->dest, new_bb; basic_block else_bb = else_edge->dest, new_bb;
edge then_succ = then_bb->succ; edge then_succ = then_bb->succ;
int then_bb_index;
/* THEN has one successor. */ /* THEN has one successor. */
if (!then_succ || then_succ->succ_next != NULL) if (!then_succ || then_succ->succ_next != NULL)
...@@ -2319,11 +2312,15 @@ find_if_case_1 (test_bb, then_edge, else_edge) ...@@ -2319,11 +2312,15 @@ find_if_case_1 (test_bb, then_edge, else_edge)
then_bb->global_live_at_end, BITMAP_IOR); then_bb->global_live_at_end, BITMAP_IOR);
new_bb = redirect_edge_and_branch_force (FALLTHRU_EDGE (test_bb), else_bb); new_bb = redirect_edge_and_branch_force (FALLTHRU_EDGE (test_bb), else_bb);
then_bb_index = then_bb->index;
flow_delete_block (then_bb);
/* Make rest of code believe that the newly created block is the THEN_BB /* Make rest of code believe that the newly created block is the THEN_BB
block we are going to remove. */ block we removed. */
if (new_bb) if (new_bb)
new_bb->aux = then_bb->aux; {
flow_delete_block (then_bb); new_bb->index = then_bb_index;
BASIC_BLOCK (then_bb_index) = new_bb;
}
/* We've possibly created jump to next insn, cleanup_cfg will solve that /* We've possibly created jump to next insn, cleanup_cfg will solve that
later. */ later. */
...@@ -2366,8 +2363,8 @@ find_if_case_2 (test_bb, then_edge, else_edge) ...@@ -2366,8 +2363,8 @@ find_if_case_2 (test_bb, then_edge, else_edge)
if (note && INTVAL (XEXP (note, 0)) >= REG_BR_PROB_BASE / 2) if (note && INTVAL (XEXP (note, 0)) >= REG_BR_PROB_BASE / 2)
; ;
else if (else_succ->dest->index < 0 else if (else_succ->dest->index < 0
|| TEST_BIT (post_dominators[ORIG_INDEX (then_bb)], || TEST_BIT (post_dominators[then_bb->index],
ORIG_INDEX (else_succ->dest))) else_succ->dest->index))
; ;
else else
return FALSE; return FALSE;
...@@ -2706,10 +2703,6 @@ if_convert (x_life_data_ok) ...@@ -2706,10 +2703,6 @@ if_convert (x_life_data_ok)
if (life_data_ok) if (life_data_ok)
clear_bb_flags (); clear_bb_flags ();
/* Record initial block numbers. */
FOR_EACH_BB (bb)
SET_ORIG_INDEX (bb, bb->index);
/* Go through each of the basic blocks looking for things to convert. */ /* Go through each of the basic blocks looking for things to convert. */
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
while (find_if_header (bb)) while (find_if_header (bb))
......
...@@ -1290,7 +1290,7 @@ optimize_mode_switching (file) ...@@ -1290,7 +1290,7 @@ optimize_mode_switching (file)
#ifdef NORMAL_MODE #ifdef NORMAL_MODE
/* Restore the special status of EXIT_BLOCK. */ /* Restore the special status of EXIT_BLOCK. */
n_basic_blocks--; last_basic_block--;
VARRAY_POP (basic_block_info); VARRAY_POP (basic_block_info);
EXIT_BLOCK_PTR->index = EXIT_BLOCK; EXIT_BLOCK_PTR->index = EXIT_BLOCK;
#endif #endif
......
...@@ -1206,8 +1206,6 @@ estimate_bb_frequencies (loops) ...@@ -1206,8 +1206,6 @@ estimate_bb_frequencies (loops)
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
BLOCK_INFO (bb)->tovisit = 1; BLOCK_INFO (bb)->tovisit = 1;
BLOCK_INFO (ENTRY_BLOCK_PTR)->tovisit = 1;
BLOCK_INFO (EXIT_BLOCK_PTR)->tovisit = 1;
propagate_freq (ENTRY_BLOCK_PTR); propagate_freq (ENTRY_BLOCK_PTR);
memcpy (&freq_max, &real_zero, sizeof (real_zero)); memcpy (&freq_max, &real_zero, sizeof (real_zero));
......
...@@ -831,6 +831,9 @@ branch_prob () ...@@ -831,6 +831,9 @@ branch_prob ()
num_edges = NUM_EDGES (el); num_edges = NUM_EDGES (el);
alloc_aux_for_edges (sizeof (struct edge_info)); alloc_aux_for_edges (sizeof (struct edge_info));
/* The basic blocks are expected to be numbered sequentially. */
compact_blocks ();
ignored_edges = 0; ignored_edges = 0;
for (i = 0 ; i < num_edges ; i++) for (i = 0 ; i < num_edges ; i++)
{ {
......
...@@ -680,7 +680,7 @@ find_rgns (edge_list, dom) ...@@ -680,7 +680,7 @@ find_rgns (edge_list, dom)
in_stack = sbitmap_alloc (last_basic_block); in_stack = sbitmap_alloc (last_basic_block);
sbitmap_zero (in_stack); sbitmap_zero (in_stack);
for (i = 0; i < n_basic_blocks; i++) for (i = 0; i < last_basic_block; i++)
max_hdr[i] = -1; max_hdr[i] = -1;
/* DFS traversal to find inner loops in the cfg. */ /* DFS traversal to find inner loops in the cfg. */
......
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