[patch] tree-ssa-dce.c: Don't let an explicit GOTO_EXPR slip through.

Kazu Hirata kazu@cs.umass.edu
Wed Oct 27 05:44:00 GMT 2004


Hi,

Attached is a patch to teach DCE not to let an explicit GOTO_EXPR slip
through.

All of simple GOTO_EXPRs are represented implicitly.  If we have an
"if" statement checking for a simple GOTO_EXPR, we might as well turn
that into gcc_assert.

verify_flow_info has an identical check, so you could argue that
gcc_assert would be duplicate.  In any case, we shouldn't have an "if"
there because that deceive us into thinking we handle two different
kinds of GOTO_EXPR, ones that satisfy simple_goto_p and ones that
don't.

Tested on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2004-10-27  Kazu Hirata  <kazu@cs.umass.edu>

	* tree-ssa-dce.c (mark_stmt_if_obviously_necessary)
	<GOTO_EXPR>: Don't let an explicit GOTO_EXPR slip through.

Index: tree-ssa-dce.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dce.c,v
retrieving revision 2.22
diff -u -p -r2.22 tree-ssa-dce.c
--- tree-ssa-dce.c	29 Sep 2004 23:08:31 -0000	2.22
+++ tree-ssa-dce.c	26 Oct 2004 18:35:24 -0000
@@ -323,8 +323,8 @@ mark_stmt_if_obviously_necessary (tree s
       break;
 
     case GOTO_EXPR:
-      if (! simple_goto_p (stmt))
-	mark_stmt_necessary (stmt, true);
+      gcc_assert (!simple_goto_p (stmt));
+      mark_stmt_necessary (stmt, true);
       return;
 
     case COND_EXPR:



More information about the Gcc-patches mailing list