This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/12688] [tree-ssa] ICE building tcl
- From: "dnovillo at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Oct 2003 02:35:15 -0000
- Subject: [Bug optimization/12688] [tree-ssa] ICE building tcl
- References: <20031020143540.12688.green@redhat.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12688
------- Additional Comments From dnovillo at redhat dot com 2003-10-21 02:35 -------
Subject: [tree-ssa] Fix folding statements into NOPs
When a statement like 'memcpy (T.241_91, (const char *)"", 0);' is
folded into 'T.241_91', we should replace the statement with a NOP
because it has no effect.
This fixes the PR and allows IA64 bootstraps to finish (only to die as
per http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12347 which I'll be
tackling next).
Diego.
* tree-dfa.c (get_stmt_operands): Don't return early when dealing
with an empty statement.
* tree-ssa-ccp.c (set_rhs): If the expression has no side effects,
replace the statement with an empty statement.
Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-dfa.c,v
retrieving revision 1.1.4.173
diff -d -c -p -d -c -p -r1.1.4.173 tree-dfa.c
*** tree-dfa.c 18 Oct 2003 03:09:47 -0000 1.1.4.173
--- tree-dfa.c 21 Oct 2003 00:09:53 -0000
*************** get_stmt_operands (tree stmt)
*** 182,189 ****
abort ();
#endif
! /* Ignore empty and error statements. */
! if (IS_EMPTY_STMT (stmt) || TREE_CODE (stmt) == ERROR_MARK)
return;
/* If the statement has not been modified, the operands are still valid. */
--- 182,189 ----
abort ();
#endif
! /* Ignore error statements. */
! if (TREE_CODE (stmt) == ERROR_MARK)
return;
/* If the statement has not been modified, the operands are still valid. */
*************** get_stmt_operands (tree stmt)
*** 288,297 ****
default:
/* Notice that if get_expr_operands tries to use &STMT as the operand
pointer (which may only happen for USE operands), we will abort in
! add_use. This default will handle statements like CALL_EXPRs or
! VA_ARG_EXPRs that may appear on the RHS of a statement or as
! statements themselves. */
! get_expr_operands (stmt, &stmt, opf_none, prev_vops);
break;
}
--- 288,298 ----
default:
/* Notice that if get_expr_operands tries to use &STMT as the operand
pointer (which may only happen for USE operands), we will abort in
! add_use. This default will handle statements like empty statements,
! CALL_EXPRs or VA_ARG_EXPRs that may appear on the RHS of a statement
! or as statements themselves. */
! if (!IS_EMPTY_STMT (stmt))
! get_expr_operands (stmt, &stmt, opf_none, prev_vops);
break;
}
Index: tree-ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-ccp.c,v
retrieving revision 1.1.2.103
diff -d -c -p -d -c -p -r1.1.2.103 tree-ssa-ccp.c
*** tree-ssa-ccp.c 18 Oct 2003 03:09:47 -0000 1.1.2.103
--- tree-ssa-ccp.c 21 Oct 2003 00:09:53 -0000
*************** set_rhs (tree *stmt_p, tree expr)
*** 1750,1756 ****
else
{
stmt_ann_t ann = stmt_ann (stmt);
! *stmt_p = expr;
(*stmt_p)->common.ann = (tree_ann) ann;
}
}
--- 1750,1764 ----
else
{
stmt_ann_t ann = stmt_ann (stmt);
! if (TREE_SIDE_EFFECTS (expr))
! *stmt_p = expr;
! else
! {
! /* If the expression is not a statement with side-effects, replace
! the statement with a new empty statement. */
! *stmt_p = build_empty_stmt ();
! }
!
(*stmt_p)->common.ann = (tree_ann) ann;
}
}