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] [PATCH]: Fix DCE not updating bb->end_tree_p


Okay to apply?
Bootstrapped with java, c++, f77, objc, c on x86 with PRE on, and works
fine.


2003-07-15  Daniel Berlin  <dberlin@dberlin.org>

	* tree-cfg.c (remove_stmt): Update bb->end_tree_p properly when
	stmt_p is the end of the bb.

Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-cfg.c,v
retrieving revision 1.1.4.127
diff -u -3 -p -r1.1.4.127 tree-cfg.c
--- tree-cfg.c	14 Jul 2003 21:18:48 -0000	1.1.4.127
+++ tree-cfg.c	15 Jul 2003 20:50:23 -0000
@@ -2045,6 +2045,21 @@ remove_stmt (tree *stmt_p)
 	SSA_NAME_DEF_STMT (vdef) = build_empty_stmt ();
     }

+  /* Update end_tree_p when stmt_p is the end of the tree.  We don't
+     need to handle the COMPOUND_EXPR case, since that's handled
+     below.  We don't need to handle the one statement bb case, since
+     we will remove the bb anyway.  */
+  if (bb && bb->end_tree_p == stmt_p && bb->head_tree_p != stmt_p
+      && TREE_CODE (*stmt_p) != COMPOUND_EXPR)
+    {
+      block_stmt_iterator bsi;
+      bsi = bsi_start (bb);
+      while (bsi_stmt_ptr (bsi) != stmt_p)
+        bsi_next_in_bb (&bsi, bb);
+      bsi_prev (&bsi);
+      bb->end_tree_p = bsi_container (bsi);
+    }
+
   stmt->common.ann = NULL;

   /* The RHS of a MODIFY_EXPR has an annotation for the benefit of


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