This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa]: PRE updates and note on bug
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: Andrew MacLeod <amacleod at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Diego Novillo <dnovillo at redhat dot com>
- Date: Tue, 22 Jul 2003 12:57:20 -0400 (EDT)
- Subject: Re: [tree-ssa]: PRE updates and note on bug
- References: <Pine.LNX.4.56.0307220048410.28982@dberlin.org><1058877669.2344.1436.camel@p4>
> I thought we resolved this last week? You had a patch for
> remove_stmt()...
>
> Or did it not fix your problem?
If you apply the following patch, you can see where we still have
problems (this includes when a cond_expr is the end of the bb, and we
remove it, when we remove empty statements and the previous statement is
an empty statement, etc).
We probably should use this patch (without the #if 0'd code, of course, i
was just trying to start attacking the various cases) once all the cases
are handled, or to force ourselves to fix the bugs.
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-cfg.c,v
retrieving revision 1.1.4.132
diff -u -3 -p -r1.1.4.132 tree-cfg.c
--- tree-cfg.c 22 Jul 2003 02:50:14 -0000 1.1.4.132
+++ tree-cfg.c 22 Jul 2003 16:52:43 -0000
@@ -2017,6 +2017,24 @@ bsi_replace (block_stmt_iterator bsi, tr
+static int
+count_stmts_in_bb (basic_block bb)
+{
+ block_stmt_iterator bsi;
+ int num_stmt1 = 0;
+ int num_stmt2 = 0;
+
+ bsi = bsi_start (bb);
+ for (; !bsi_end_p (bsi); bsi_next (&bsi))
+ num_stmt1++;
+
+ bsi = bsi_last (bb);
+ for (; !bsi_end_p (bsi); bsi_prev (&bsi))
+ num_stmt2++;
+ if (num_stmt1 != num_stmt2)
+ abort ();
+ return num_stmt1;
+}
/* Remove statement *STMT_P.
Update all references associated with it. Note that this function will
@@ -2087,7 +2105,18 @@ remove_stmt (tree *stmt_p)
bsi_prev (&bsi);
bb->end_tree_p = bsi_container (bsi);
}
-
+#if 0
+ else if (bb
+ && (bb->head_tree_p != bb->end_tree_p)
+ && !bsi_end_p (bsi_last (bb))
+ && bsi_stmt (bsi_last (bb)) == stmt)
+ {
+ block_stmt_iterator bsi;
+ bsi = bsi_last (bb);
+ bsi_prev (&bsi);
+ bb->end_tree_p = bsi_container (bsi);
+ }
+#endif
stmt->common.ann = NULL;
/* The RHS of a MODIFY_EXPR has an annotation for the benefit of
@@ -2126,6 +2155,7 @@ remove_stmt (tree *stmt_p)
if (update_end)
bb->end_tree_p = stmt_p;
+ count_stmts_in_bb (bb);
}