+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
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);
}
/* ... 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. */
&& 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
{
{
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);
+}
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. */
{
for (loop = bb->loop_father;
loop_outer (loop); loop = loop_outer (loop))
- {
- loop->header = NULL;
- loop->latch = NULL;
- }
+ mark_loop_for_removal (loop);
}
}
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);
/* 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. */
{
/* 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);
}