cfgloop.c (mark_loop_for_removal): New function.

2014-09-05  Richard Biener  <rguenther@suse.de>

	* cfgloop.c (mark_loop_for_removal): New function.
	* cfgloop.h (mark_loop_for_removal): Declare.
	* cfghooks.c (delete_basic_block): Use mark_loop_for_removal.
	(merge_blocks): Likewise.
	(duplicate_block): Likewise.
	* except.c (sjlj_emit_dispatch_table): Likewise.
	* tree-eh.c (cleanup_empty_eh_merge_phis): Likewise.
	* tree-ssa-threadupdate.c (ssa_redirect_edges): Likewise.
	(thread_through_loop_header): Likewise.

From-SVN: r214942
This commit is contained in:
Richard Biener 2014-09-05 09:17:49 +00:00 committed by Richard Biener
parent f65586dcd1
commit 08c13199cf
7 changed files with 33 additions and 29 deletions

View File

@ -1,3 +1,15 @@
2014-09-05 Richard Biener <rguenther@suse.de>
* cfgloop.c (mark_loop_for_removal): New function.
* cfgloop.h (mark_loop_for_removal): Declare.
* cfghooks.c (delete_basic_block): Use mark_loop_for_removal.
(merge_blocks): Likewise.
(duplicate_block): Likewise.
* except.c (sjlj_emit_dispatch_table): Likewise.
* tree-eh.c (cleanup_empty_eh_merge_phis): Likewise.
* tree-ssa-threadupdate.c (ssa_redirect_edges): Likewise.
(thread_through_loop_header): Likewise.
2014-09-05 Richard Biener <rguenther@suse.de>
PR middle-end/63148

View File

@ -569,14 +569,10 @@ delete_basic_block (basic_block bb)
struct loop *loop = bb->loop_father;
/* If we remove the header or the latch of a loop, mark the loop for
removal by setting its header and latch to NULL. */
removal. */
if (loop->latch == bb
|| loop->header == bb)
{
loop->header = NULL;
loop->latch = NULL;
loops_state_set (LOOPS_NEED_FIXUP);
}
mark_loop_for_removal (loop);
remove_bb_from_loops (bb);
}
@ -760,11 +756,7 @@ merge_blocks (basic_block a, basic_block b)
/* ... we merge two loop headers, in which case we kill
the inner loop. */
if (b->loop_father->header == b)
{
b->loop_father->header = NULL;
b->loop_father->latch = NULL;
loops_state_set (LOOPS_NEED_FIXUP);
}
mark_loop_for_removal (b->loop_father);
}
/* If we merge a loop header into its predecessor, update the loop
structure. */
@ -1099,9 +1091,7 @@ duplicate_block (basic_block bb, edge e, basic_block after)
&& cloop->header == bb)
{
add_bb_to_loop (new_bb, loop_outer (cloop));
cloop->header = NULL;
cloop->latch = NULL;
loops_state_set (LOOPS_NEED_FIXUP);
mark_loop_for_removal (cloop);
}
else
{

View File

@ -1921,3 +1921,13 @@ bb_loop_depth (const_basic_block bb)
{
return bb->loop_father ? loop_depth (bb->loop_father) : 0;
}
/* Marks LOOP for removal and sets LOOPS_NEED_FIXUP. */
void
mark_loop_for_removal (loop_p loop)
{
loop->header = NULL;
loop->latch = NULL;
loops_state_set (LOOPS_NEED_FIXUP);
}

View File

@ -336,6 +336,8 @@ struct loop * loop_version (struct loop *, void *,
extern bool remove_path (edge);
extern void unloop (struct loop *, bool *, bitmap);
extern void scale_loop_frequencies (struct loop *, int, int);
void mark_loop_for_removal (loop_p);
/* Induction variable analysis. */

View File

@ -1375,10 +1375,7 @@ sjlj_emit_dispatch_table (rtx_code_label *dispatch_label, int num_dispatch)
{
for (loop = bb->loop_father;
loop_outer (loop); loop = loop_outer (loop))
{
loop->header = NULL;
loop->latch = NULL;
}
mark_loop_for_removal (loop);
}
}

View File

@ -4171,10 +4171,9 @@ cleanup_empty_eh_merge_phis (basic_block new_bb, basic_block old_bb,
and mark the other loop as possibly having multiple latches. */
if (e->dest == e->dest->loop_father->header)
{
e->dest->loop_father->header = NULL;
e->dest->loop_father->latch = NULL;
mark_loop_for_removal (e->dest->loop_father);
new_bb->loop_father->latch = NULL;
loops_state_set (LOOPS_NEED_FIXUP|LOOPS_MAY_HAVE_MULTIPLE_LATCHES);
loops_state_set (LOOPS_MAY_HAVE_MULTIPLE_LATCHES);
}
redirect_eh_edge_1 (e, new_bb, change_region);
redirect_edge_succ (e, new_bb);

View File

@ -766,11 +766,7 @@ ssa_redirect_edges (struct redirection_data **slot,
/* If we redirect a loop latch edge cancel its loop. */
if (e->src == e->src->loop_father->latch)
{
e->src->loop_father->header = NULL;
e->src->loop_father->latch = NULL;
loops_state_set (LOOPS_NEED_FIXUP);
}
mark_loop_for_removal (e->src->loop_father);
/* Redirect the incoming edge (possibly to the joiner block) to the
appropriate duplicate block. */
@ -1304,9 +1300,7 @@ thread_through_loop_header (struct loop *loop, bool may_peel_loop_headers)
{
/* If the loop ceased to exist, mark it as such, and thread through its
original header. */
loop->header = NULL;
loop->latch = NULL;
loops_state_set (LOOPS_NEED_FIXUP);
mark_loop_for_removal (loop);
return thread_block (header, false);
}