]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-cfg.c (gimple_split_block): Remove loop finding stmt to split on.
authorRichard Biener <rguenther@suse.de>
Thu, 12 Mar 2015 08:48:32 +0000 (08:48 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 12 Mar 2015 08:48:32 +0000 (08:48 +0000)
2015-03-12  Richard Biener  <rguenther@suse.de>

* tree-cfg.c (gimple_split_block): Remove loop finding stmt
to split on.
* omp-low.c (expand_omp_taskreg): Split block before removing
the stmt.
(expand_omp_target): Likewise.
* ubsan.c (ubsan_expand_null_ifn): Adjust stmt if we replaced it.
* tree-parloops.c (create_call_for_reduction_1): Pass a proper
stmt to split_block.

From-SVN: r221377

gcc/ChangeLog
gcc/omp-low.c
gcc/tree-cfg.c
gcc/tree-parloops.c
gcc/ubsan.c

index d7eac0959fa097a856cee15d7da255356dd5c757..e800af187578fd43223b52e017f1f08c80c64c34 100644 (file)
@@ -1,3 +1,14 @@
+2015-03-12  Richard Biener  <rguenther@suse.de>
+
+       * tree-cfg.c (gimple_split_block): Remove loop finding stmt
+       to split on.
+       * omp-low.c (expand_omp_taskreg): Split block before removing
+       the stmt.
+       (expand_omp_target): Likewise.
+       * ubsan.c (ubsan_expand_null_ifn): Adjust stmt if we replaced it.
+       * tree-parloops.c (create_call_for_reduction_1): Pass a proper
+       stmt to split_block.
+
 2015-03-12  Tom de Vries  <tom@codesourcery.com>
 
        PR rtl-optimization/64895
index 75d6707f1987f3a93f53af7ce1ffa75924ff3746..2d64a74e3eaf89c46b9e859ee624c98d292f6521 100644 (file)
@@ -5514,8 +5514,8 @@ expand_omp_taskreg (struct omp_region *region)
       stmt = gsi_stmt (gsi);
       gcc_assert (stmt && (gimple_code (stmt) == GIMPLE_OMP_PARALLEL
                           || gimple_code (stmt) == GIMPLE_OMP_TASK));
-      gsi_remove (&gsi, true);
       e = split_block (entry_bb, stmt);
+      gsi_remove (&gsi, true);
       entry_bb = e->dest;
       single_succ_edge (entry_bb)->flags = EDGE_FALLTHRU;
 
@@ -8889,8 +8889,8 @@ expand_omp_target (struct omp_region *region)
       stmt = gsi_stmt (gsi);
       gcc_assert (stmt
                  && gimple_code (stmt) == gimple_code (entry_stmt));
-      gsi_remove (&gsi, true);
       e = split_block (entry_bb, stmt);
+      gsi_remove (&gsi, true);
       entry_bb = e->dest;
       single_succ_edge (entry_bb)->flags = EDGE_FALLTHRU;
 
index 006bc08bbcac7d85f7841eda58a0e5b9b1fa404a..e1bc14351baf749d359d7c9aef9548d8799f8f58 100644 (file)
@@ -5683,7 +5683,6 @@ gimple_split_block (basic_block bb, void *stmt)
 {
   gimple_stmt_iterator gsi;
   gimple_stmt_iterator gsi_tgt;
-  gimple act;
   gimple_seq list;
   basic_block new_bb;
   edge e;
@@ -5697,26 +5696,16 @@ gimple_split_block (basic_block bb, void *stmt)
   FOR_EACH_EDGE (e, ei, new_bb->succs)
     e->src = new_bb;
 
-  if (stmt && gimple_code ((gimple) stmt) == GIMPLE_LABEL)
-    stmt = NULL;
-
-  /* Move everything from GSI to the new basic block.  */
-  for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+  /* Get a stmt iterator pointing to the first stmt to move.  */
+  if (!stmt || gimple_code ((gimple) stmt) == GIMPLE_LABEL)
+    gsi = gsi_after_labels (bb);
+  else
     {
-      act = gsi_stmt (gsi);
-      if (gimple_code (act) == GIMPLE_LABEL)
-       continue;
-
-      if (!stmt)
-       break;
-
-      if (stmt == act)
-       {
-         gsi_next (&gsi);
-         break;
-       }
+      gsi = gsi_for_stmt ((gimple) stmt);
+      gsi_next (&gsi);
     }
-
+  /* Move everything from GSI to the new basic block.  */
   if (gsi_end_p (gsi))
     return new_bb;
 
index 5f7c1bc360ab9f71e8039434aa7cb3b10c627418..fbb9eebddcf23e0c3498668e7aaa4708d302f255 100644 (file)
@@ -1111,7 +1111,8 @@ create_call_for_reduction_1 (reduction_info **slot, struct clsn_data *clsn_data)
   /* Create phi node.  */
   bb = clsn_data->load_bb;
 
-  e = split_block (bb, t);
+  gsi = gsi_last_bb (bb);
+  e = split_block (bb, gsi_stmt (gsi));
   new_bb = e->dest;
 
   tmp_load = create_tmp_var (TREE_TYPE (TREE_TYPE (addr)));
index 98edfe03a25cb0bdbcfb49ee6b3661b6427b91db..0e23d919744de85acd93193db5ae3ad79013c73f 100644 (file)
@@ -864,6 +864,7 @@ ubsan_expand_null_ifn (gimple_stmt_iterator *gsip)
 
       /* Replace the UBSAN_NULL with a GIMPLE_COND stmt.  */
       gsi_replace (&gsi, g, false);
+      stmt = g;
     }
 
   if (check_align)