Commit 08c13199 by Richard Biener Committed by Richard Biener

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
parent f65586dc
2014-09-05 Richard Biener <rguenther@suse.de> 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 PR middle-end/63148
* fold-const.c (try_move_mult_to_index): Remove. * fold-const.c (try_move_mult_to_index): Remove.
(fold_binary_loc): Do not call it. (fold_binary_loc): Do not call it.
...@@ -569,14 +569,10 @@ delete_basic_block (basic_block bb) ...@@ -569,14 +569,10 @@ delete_basic_block (basic_block bb)
struct loop *loop = bb->loop_father; struct loop *loop = bb->loop_father;
/* If we remove the header or the latch of a loop, mark the loop for /* 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 if (loop->latch == bb
|| loop->header == bb) || loop->header == bb)
{ mark_loop_for_removal (loop);
loop->header = NULL;
loop->latch = NULL;
loops_state_set (LOOPS_NEED_FIXUP);
}
remove_bb_from_loops (bb); remove_bb_from_loops (bb);
} }
...@@ -760,11 +756,7 @@ merge_blocks (basic_block a, basic_block b) ...@@ -760,11 +756,7 @@ merge_blocks (basic_block a, basic_block b)
/* ... we merge two loop headers, in which case we kill /* ... we merge two loop headers, in which case we kill
the inner loop. */ the inner loop. */
if (b->loop_father->header == b) if (b->loop_father->header == b)
{ mark_loop_for_removal (b->loop_father);
b->loop_father->header = NULL;
b->loop_father->latch = NULL;
loops_state_set (LOOPS_NEED_FIXUP);
}
} }
/* If we merge a loop header into its predecessor, update the loop /* If we merge a loop header into its predecessor, update the loop
structure. */ structure. */
...@@ -1099,9 +1091,7 @@ duplicate_block (basic_block bb, edge e, basic_block after) ...@@ -1099,9 +1091,7 @@ duplicate_block (basic_block bb, edge e, basic_block after)
&& cloop->header == bb) && cloop->header == bb)
{ {
add_bb_to_loop (new_bb, loop_outer (cloop)); add_bb_to_loop (new_bb, loop_outer (cloop));
cloop->header = NULL; mark_loop_for_removal (cloop);
cloop->latch = NULL;
loops_state_set (LOOPS_NEED_FIXUP);
} }
else else
{ {
......
...@@ -1921,3 +1921,13 @@ bb_loop_depth (const_basic_block bb) ...@@ -1921,3 +1921,13 @@ bb_loop_depth (const_basic_block bb)
{ {
return bb->loop_father ? loop_depth (bb->loop_father) : 0; 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);
}
...@@ -336,6 +336,8 @@ struct loop * loop_version (struct loop *, void *, ...@@ -336,6 +336,8 @@ struct loop * loop_version (struct loop *, void *,
extern bool remove_path (edge); extern bool remove_path (edge);
extern void unloop (struct loop *, bool *, bitmap); extern void unloop (struct loop *, bool *, bitmap);
extern void scale_loop_frequencies (struct loop *, int, int); extern void scale_loop_frequencies (struct loop *, int, int);
void mark_loop_for_removal (loop_p);
/* Induction variable analysis. */ /* Induction variable analysis. */
......
...@@ -1375,10 +1375,7 @@ sjlj_emit_dispatch_table (rtx_code_label *dispatch_label, int num_dispatch) ...@@ -1375,10 +1375,7 @@ sjlj_emit_dispatch_table (rtx_code_label *dispatch_label, int num_dispatch)
{ {
for (loop = bb->loop_father; for (loop = bb->loop_father;
loop_outer (loop); loop = loop_outer (loop)) loop_outer (loop); loop = loop_outer (loop))
{ mark_loop_for_removal (loop);
loop->header = NULL;
loop->latch = NULL;
}
} }
} }
......
...@@ -4171,10 +4171,9 @@ cleanup_empty_eh_merge_phis (basic_block new_bb, basic_block old_bb, ...@@ -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. */ and mark the other loop as possibly having multiple latches. */
if (e->dest == e->dest->loop_father->header) if (e->dest == e->dest->loop_father->header)
{ {
e->dest->loop_father->header = NULL; mark_loop_for_removal (e->dest->loop_father);
e->dest->loop_father->latch = NULL;
new_bb->loop_father->latch = NULL; 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_eh_edge_1 (e, new_bb, change_region);
redirect_edge_succ (e, new_bb); redirect_edge_succ (e, new_bb);
......
...@@ -766,11 +766,7 @@ ssa_redirect_edges (struct redirection_data **slot, ...@@ -766,11 +766,7 @@ ssa_redirect_edges (struct redirection_data **slot,
/* If we redirect a loop latch edge cancel its loop. */ /* If we redirect a loop latch edge cancel its loop. */
if (e->src == e->src->loop_father->latch) if (e->src == e->src->loop_father->latch)
{ mark_loop_for_removal (e->src->loop_father);
e->src->loop_father->header = NULL;
e->src->loop_father->latch = NULL;
loops_state_set (LOOPS_NEED_FIXUP);
}
/* Redirect the incoming edge (possibly to the joiner block) to the /* Redirect the incoming edge (possibly to the joiner block) to the
appropriate duplicate block. */ appropriate duplicate block. */
...@@ -1304,9 +1300,7 @@ thread_through_loop_header (struct loop *loop, bool may_peel_loop_headers) ...@@ -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 /* If the loop ceased to exist, mark it as such, and thread through its
original header. */ original header. */
loop->header = NULL; mark_loop_for_removal (loop);
loop->latch = NULL;
loops_state_set (LOOPS_NEED_FIXUP);
return thread_block (header, false); return thread_block (header, false);
} }
......
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