This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tree-ssa]: Use replacement rather than insertion for single statementbb's


There's no point in inserting *after* a bb consisting only of a (void)0
during edge insertion, when we can simply replace the existing statement.

Okay?

2003-08-03  Daniel Berlin  <dberlin@dberlin.org>

	* tree-cfg.c (bsi_insert_on_edge_immediate): If there's only
	one statement in the block, and it's an empty statement, replace it.

Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-cfg.c,v
retrieving revision 1.1.4.138
diff -u -3 -p -r1.1.4.138 tree-cfg.c
--- tree-cfg.c	31 Jul 2003 00:50:49 -0000	1.1.4.138
+++ tree-cfg.c	3 Aug 2003 15:34:48 -0000
@@ -4140,11 +4140,22 @@ bsi_insert_on_edge_immediate (edge e, tr

       if (!is_ctrl_stmt (last) && !is_ctrl_altering_stmt (last))
 	{
-	  bsi_insert_after (&bsi, stmt, BSI_SAME_STMT);
-	  if (old_bsi)
-	    *old_bsi = bsi;
-	  bsi_next (&bsi);
-	  return bsi;
+	  if (src->head_tree_p == src->end_tree_p
+	      && IS_EMPTY_STMT (*src->head_tree_p))
+	    {
+	      bsi_replace (bsi, stmt);
+	      if (old_bsi)
+		*old_bsi = bsi;
+	      return bsi;
+	    }
+	  else
+	    {
+	      bsi_insert_after (&bsi, stmt, BSI_SAME_STMT);
+	      if (old_bsi)
+		*old_bsi = bsi;
+	      bsi_next (&bsi);
+	      return bsi;
+	    }
 	}

       /* If the last stmt is a GOTO, the we can simply insert before it.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]