cfgloop.c (mark_loop_for_removal): New function.
authorRichard Biener <rguenther@suse.de>
Fri, 5 Sep 2014 09:17:49 +0000 (09:17 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 5 Sep 2014 09:17:49 +0000 (09:17 +0000)
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

gcc/ChangeLog
gcc/cfghooks.c
gcc/cfgloop.c
gcc/cfgloop.h
gcc/except.c
gcc/tree-eh.c
gcc/tree-ssa-threadupdate.c

index 51c8a08df6907edb526e1492ceacec0a089c489f..9c329a9189ee4d246059fadbe3ce628a55a3c1db 100644 (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
index 90bc6cf1e9f7a064b5e58358b6b97099825021d0..fa18214e1ff4a6a9fbd3f29aaf28271c9d599c6f 100644 (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
        {
index dcf23ca1fbbf240d3344879dce128bd3c901d2f9..789c45a8f0348fcfefd833d3e8d09e8e131662b2 100644 (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);
+}
index b7f5d2a22a6c154af41a23a0f4dc42452236301b..e868f5d4ba1490b99216672b6352b6e78afe68df 100644 (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.  */
 
index fecc06046a231f32efa41018646a07ad7bc8f1f0..78518ea808be6847131ecf40c14b6cce362f74f7 100644 (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);
              }
          }
 
index 9da8da28b3656e1d774441dfb9dd8972f77d3600..d8032538c0ab1fae0a8080c588518ca051e035af 100644 (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);
index a0b1be544adf358729e2675cb26405fe1b105e4f..ae1e7bacb5a5bd8e5ba6df791d61d8a971b5f266 100644 (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);
     }