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] Another edge insertion fix


Fixes the case where we insert a statement after the last statement
inside a scope.  In that case, there is no need to update the chaining
with the first statement of the next block.

Bootstrapped and tested on x86.


Diego.

	* tree-cfg.c (bsi_insert_on_edge_immediate): Only update the
	container for the head tree of the next block if the new statement
	needs to be linked to it.

Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-cfg.c,v
retrieving revision 1.1.4.145
diff -d -u -p -r1.1.4.145 tree-cfg.c
--- tree-cfg.c	13 Aug 2003 19:56:51 -0000	1.1.4.145
+++ tree-cfg.c	14 Aug 2003 12:29:22 -0000
@@ -4405,13 +4405,15 @@ bsi_insert_on_edge_immediate (edge e, tr
 
       case EDGE_INSERT_LOCATION_BEFORE:
       case EDGE_INSERT_LOCATION_AFTER:
-	/* The container for the head of the dest block has been changed.
-	   (we've linked a new stmt in front of it.)  */
-
 	tsi_next (&tsi);
-	if (dest->end_tree_p == dest->head_tree_p)
-	  dest->end_tree_p = tsi_container (tsi);
-	dest->head_tree_p = tsi_container (tsi);
+	if (!tsi_end_p (tsi))
+	  {
+	    /* The container for the head of the dest block has been
+	       changed. (we've linked a new stmt in front of it.)  */
+	    if (dest->end_tree_p == dest->head_tree_p)
+	      dest->end_tree_p = tsi_container (tsi);
+	    dest->head_tree_p = tsi_container (tsi);
+	  }
 	break;
 
       case EDGE_INSERT_LOCATION_NEW_ELSE:



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