Commit 473fb060 by Jan Hubicka Committed by Jan Hubicka

basic-block.h (purge_all_dead_edges): Add update_life_p argument.

	* basic-block.h (purge_all_dead_edges): Add update_life_p argument.
	* cfgcleanup.c (merge_blocks): Update the life flag after merging;
	fix warning.
	* cfgrtl.c (purge_all_dead_edges): Allow updating of liveness.
	(life_analysis): call purge_all_dead_edges after deleting noops.
	(delete_noop_move): Do not purge CFG.
	* toplev.c (rest_of_compilation): Update purge_all_dead_edges call.

From-SVN: r46605
parent 4fdaa878
Mon Oct 29 12:43:06 CET 2001 Jan Hubicka <jh@suse.cz>
* basic-block.h (purge_all_dead_edges): Add update_life_p argument.
* cfgcleanup.c (merge_blocks): Update the life flag after merging;
fix warning.
* cfgrtl.c (purge_all_dead_edges): Allow updating of liveness.
(life_analysis): call purge_all_dead_edges after deleting noops.
(delete_noop_move): Do not purge CFG.
* toplev.c (rest_of_compilation): Update purge_all_dead_edges call.
2001-10-28 David Edelsohn <edelsohn@gnu.org> 2001-10-28 David Edelsohn <edelsohn@gnu.org>
* config/rs6000/aix31.h (ASM_OUTPUT_EXTERNAL): Use assemble_name. * config/rs6000/aix31.h (ASM_OUTPUT_EXTERNAL): Use assemble_name.
......
...@@ -638,7 +638,7 @@ extern basic_block force_nonfallthru PARAMS ((edge)); ...@@ -638,7 +638,7 @@ extern basic_block force_nonfallthru PARAMS ((edge));
extern bool redirect_edge_and_branch PARAMS ((edge, basic_block)); extern bool redirect_edge_and_branch PARAMS ((edge, basic_block));
extern rtx block_label PARAMS ((basic_block)); extern rtx block_label PARAMS ((basic_block));
extern bool forwarder_block_p PARAMS ((basic_block)); extern bool forwarder_block_p PARAMS ((basic_block));
extern bool purge_all_dead_edges PARAMS ((void)); extern bool purge_all_dead_edges PARAMS ((bool));
extern bool purge_dead_edges PARAMS ((basic_block)); extern bool purge_dead_edges PARAMS ((basic_block));
extern void find_sub_basic_blocks PARAMS ((basic_block)); extern void find_sub_basic_blocks PARAMS ((basic_block));
extern void find_many_sub_basic_blocks PARAMS ((sbitmap)); extern void find_many_sub_basic_blocks PARAMS ((sbitmap));
......
...@@ -433,6 +433,12 @@ merge_blocks (e, b, c, mode) ...@@ -433,6 +433,12 @@ merge_blocks (e, b, c, mode)
/* If B has a fallthru edge to C, no need to move anything. */ /* If B has a fallthru edge to C, no need to move anything. */
if (e->flags & EDGE_FALLTHRU) if (e->flags & EDGE_FALLTHRU)
{ {
/* We need to update liveness in case C already has broken liveness
or B ends by conditional jump to next instructions that will be
removed. */
if ((BB_FLAGS (c) & BB_UPDATE_LIFE)
|| GET_CODE (b->end) == JUMP_INSN)
BB_SET_FLAG (b, BB_UPDATE_LIFE);
merge_blocks_nomove (b, c); merge_blocks_nomove (b, c);
update_forwarder_flag (b); update_forwarder_flag (b);
...@@ -490,7 +496,7 @@ merge_blocks (e, b, c, mode) ...@@ -490,7 +496,7 @@ merge_blocks (e, b, c, mode)
if (b_has_incoming_fallthru) if (b_has_incoming_fallthru)
{ {
rtx bb; basic_block bb;
if (b_fallthru_edge->src == ENTRY_BLOCK_PTR) if (b_fallthru_edge->src == ENTRY_BLOCK_PTR)
return false; return false;
bb = force_nonfallthru (b_fallthru_edge); bb = force_nonfallthru (b_fallthru_edge);
......
...@@ -1923,10 +1923,30 @@ purge_dead_edges (bb) ...@@ -1923,10 +1923,30 @@ purge_dead_edges (bb)
*/ */
bool bool
purge_all_dead_edges () purge_all_dead_edges (update_life_p)
bool update_life_p;
{ {
int i, purged = false; int i, purged = false;
sbitmap blocks;
if (update_life_p)
{
blocks = sbitmap_alloc (n_basic_blocks);
sbitmap_zero (blocks);
}
for (i = 0; i < n_basic_blocks; i++) for (i = 0; i < n_basic_blocks; i++)
purged |= purge_dead_edges (BASIC_BLOCK (i)); {
bool purged_here;
purged_here = purge_dead_edges (BASIC_BLOCK (i));
purged |= purged_here;
if (purged_here && update_life_p)
SET_BIT (blocks, i);
}
if (update_life_p && purged)
update_life_info (blocks, UPDATE_LIFE_GLOBAL,
PROP_DEATH_NOTES | PROP_SCAN_DEAD_CODE
| PROP_KILL_DEAD_CODE);
if (update_life_p)
sbitmap_free (blocks);
return purged; return purged;
} }
...@@ -456,6 +456,7 @@ life_analysis (f, file, flags) ...@@ -456,6 +456,7 @@ life_analysis (f, file, flags)
/* Always remove no-op moves. Do this before other processing so /* Always remove no-op moves. Do this before other processing so
that we don't have to keep re-scanning them. */ that we don't have to keep re-scanning them. */
delete_noop_moves (f); delete_noop_moves (f);
purge_all_dead_edges (false);
/* Some targets can emit simpler epilogues if they know that sp was /* Some targets can emit simpler epilogues if they know that sp was
not ever modified during the function. After reload, of course, not ever modified during the function. After reload, of course,
...@@ -803,8 +804,6 @@ delete_noop_moves (f) ...@@ -803,8 +804,6 @@ delete_noop_moves (f)
PUT_CODE (insn, NOTE); PUT_CODE (insn, NOTE);
NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED; NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
NOTE_SOURCE_FILE (insn) = 0; NOTE_SOURCE_FILE (insn) = 0;
if (insn == bb->end)
purge_dead_edges (bb);
} }
} }
} }
......
...@@ -3301,7 +3301,7 @@ rest_of_compilation (decl) ...@@ -3301,7 +3301,7 @@ rest_of_compilation (decl)
/* Always purge dead edges, as we may eliminate an insn throwing /* Always purge dead edges, as we may eliminate an insn throwing
exception. */ exception. */
rebuild_jump_labels_after_combine |= purge_all_dead_edges (); rebuild_jump_labels_after_combine |= purge_all_dead_edges (true);
/* Combining insns may have turned an indirect jump into a /* Combining insns may have turned an indirect jump into a
direct jump. Rebuid the JUMP_LABEL fields of jumping direct jump. Rebuid the JUMP_LABEL fields of jumping
......
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