* tree-cfg.c (gimple_can_merge_blocks_p): Move label and
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Sep 2009 18:27:59 +0000 (18:27 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Sep 2009 18:27:59 +0000 (18:27 +0000)
        loop latch tests earlier.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151604 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-cfg.c

index 9b91445..c110d53 100644 (file)
@@ -1,5 +1,8 @@
 2009-09-10  Richard Henderson  <rth@redhat.com>
 
+       * tree-cfg.c (gimple_can_merge_blocks_p): Move label and
+       loop latch tests earlier.
+
        * gimple-iterator.c (gimple_find_edge_insert_loc): Insert
        before GIMPLE_RETURN, not after its predecessor; insert
        before GIMPLE_RESX.
index 1357064..b834943 100644 (file)
@@ -1354,6 +1354,24 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b)
       && DECL_NONLOCAL (gimple_label_label (stmt)))
     return false;
 
+  /* Examine the labels at the beginning of B.  */
+  for (gsi = gsi_start_bb (b); !gsi_end_p (gsi); gsi_next (&gsi))
+    {
+      tree lab;
+      stmt = gsi_stmt (gsi);
+      if (gimple_code (stmt) != GIMPLE_LABEL)
+       break;
+      lab = gimple_label_label (stmt);
+
+      /* Do not remove user labels.  */
+      if (!DECL_ARTIFICIAL (lab))
+       return false;
+    }
+
+  /* Protect the loop latches.  */
+  if (current_loops && b->loop_father->latch == b)
+    return false;
+
   /* It must be possible to eliminate all phi nodes in B.  If ssa form
      is not up-to-date, we cannot eliminate any phis; however, if only
      some symbols as whole are marked for renaming, this is not a problem,
@@ -1377,21 +1395,6 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b)
        }
     }
 
-  /* Do not remove user labels.  */
-  for (gsi = gsi_start_bb (b); !gsi_end_p (gsi); gsi_next (&gsi))
-    {
-      stmt = gsi_stmt (gsi);
-      if (gimple_code (stmt) != GIMPLE_LABEL)
-       break;
-      if (!DECL_ARTIFICIAL (gimple_label_label (stmt)))
-       return false;
-    }
-
-  /* Protect the loop latches.  */
-  if (current_loops
-      && b->loop_father->latch == b)
-    return false;
-
   return true;
 }