This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Remove some redundant error checks
- From: Steven Bosscher <stevenb at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 12 Mar 2005 21:46:51 +0100
- Subject: [patch] Remove some redundant error checks
- Organization: SUSE Labs
Hi,
We should never see ERROR_MARKs or error_mark_nodes in the IL
in the tree optimizers, because if there were errors, we don't
run the optimizers.
Bootstrapped&tested on x86_64-unknown-linux-gnu. OK?
Gr.
Steven
* tree-cfg.c (make_goto_expr_edges): Don't use error_mark_node.
* tree-ssa-dce.c (mark_stmt_necessary): Don't check for it.
* tree-ssa-operands.c (get_expr_operands): Likewise.
(get_expr_operands): Likewise for ERROR_MARK.
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.159
diff -u -3 -p -r2.159 tree-cfg.c
--- tree-cfg.c 11 Mar 2005 09:05:07 -0000 2.159
+++ tree-cfg.c 12 Mar 2005 17:46:17 -0000
@@ -837,7 +837,7 @@ label_to_block (tree dest)
static void
make_goto_expr_edges (basic_block bb)
{
- tree goto_t, dest;
+ tree goto_t;
basic_block target_bb;
int for_call;
block_stmt_iterator last = bsi_last (bb);
@@ -848,13 +848,10 @@ make_goto_expr_edges (basic_block bb)
CALL_EXPR or MODIFY_EXPR), then the edge is an abnormal edge resulting
from a nonlocal goto. */
if (TREE_CODE (goto_t) != GOTO_EXPR)
- {
- dest = error_mark_node;
- for_call = 1;
- }
+ for_call = 1;
else
{
- dest = GOTO_DESTINATION (goto_t);
+ tree dest = GOTO_DESTINATION (goto_t);
for_call = 0;
/* A GOTO to a local label creates normal edges. */
Index: tree-ssa-dce.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dce.c,v
retrieving revision 2.36
diff -u -3 -p -r2.36 tree-ssa-dce.c
--- tree-ssa-dce.c 11 Mar 2005 09:05:08 -0000 2.36
+++ tree-ssa-dce.c 12 Mar 2005 17:46:18 -0000
@@ -221,7 +221,6 @@ static inline void
mark_stmt_necessary (tree stmt, bool add_to_worklist)
{
gcc_assert (stmt);
- gcc_assert (stmt != error_mark_node);
gcc_assert (!DECL_P (stmt));
if (NECESSARY (stmt))
Index: tree-ssa-operands.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-operands.c,v
retrieving revision 2.64
diff -u -3 -p -r2.64 tree-ssa-operands.c
--- tree-ssa-operands.c 7 Mar 2005 13:58:08 -0000 2.64
+++ tree-ssa-operands.c 12 Mar 2005 17:46:19 -0000
@@ -998,10 +998,6 @@ get_stmt_operands (tree stmt)
_DECL. This indicates a bug in the gimplifier. */
gcc_assert (!SSA_VAR_P (stmt));
- /* Ignore error statements. */
- if (TREE_CODE (stmt) == ERROR_MARK)
- return;
-
ann = get_stmt_ann (stmt);
/* If the statement has not been modified, the operands are still valid. */
@@ -1037,7 +1033,7 @@ get_expr_operands (tree stmt, tree *expr
tree expr = *expr_p;
stmt_ann_t s_ann = stmt_ann (stmt);
- if (expr == NULL || expr == error_mark_node)
+ if (expr == NULL)
return;
code = TREE_CODE (expr);