builtins.c (fold_builtin): Don't generate NOP_EXPR that is going to be thrown away soon when IGNORE is set.

* builtins.c (fold_builtin): Don't generate NOP_EXPR that is going
	to be thrown away soon when IGNORE is set.
	* tree-ssa-ccp.c (convert_to_gimple_builtin): Add IGNORE argument
	indicating when return value shall not be computed.
	* gimplify.c (internal_get_tmp_var): Avoid random tree sharing.

From-SVN: r118091
This commit is contained in:
Jan Hubicka 2006-10-28 00:47:47 +02:00 committed by Jan Hubicka
parent cfe1b18f45
commit 2e929cf3b2
4 changed files with 23 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2006-10-27 Jan Hubicka <jh@suse.cz>
* builtins.c (fold_builtin): Don't generate NOP_EXPR that is going
to be thrown away soon when IGNORE is set.
* tree-ssa-ccp.c (convert_to_gimple_builtin): Add IGNORE argument
indicating when return value shall not be computed.
* gimplify.c (internal_get_tmp_var): Avoid random tree sharing.
2006-10-27 Vladimir Makarov <vmakarov@redhat.com>
* config/i386/i386.h (TARGET_GEODE):

View File

@ -9273,7 +9273,7 @@ tree
fold_builtin (tree fndecl, tree arglist, bool ignore)
{
tree exp = fold_builtin_1 (fndecl, arglist, ignore);
if (exp)
if (exp && !ignore)
{
exp = build1 (NOP_EXPR, TREE_TYPE (exp), exp);
TREE_NO_WARNING (exp) = 1;

View File

@ -609,7 +609,7 @@ internal_get_tmp_var (tree val, tree *pre_p, tree *post_p, bool is_formal)
if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE)
DECL_COMPLEX_GIMPLE_REG_P (t) = 1;
mod = build2 (INIT_EXPR, TREE_TYPE (t), t, val);
mod = build2 (INIT_EXPR, TREE_TYPE (t), t, unshare_expr (val));
if (EXPR_HAS_LOCATION (val))
SET_EXPR_LOCUS (mod, EXPR_LOCUS (val));

View File

@ -2465,17 +2465,24 @@ fold_stmt_inplace (tree stmt)
/* Convert EXPR into a GIMPLE value suitable for substitution on the
RHS of an assignment. Insert the necessary statements before
iterator *SI_P. */
iterator *SI_P.
When IGNORE is set, don't worry about the return value. */
static tree
convert_to_gimple_builtin (block_stmt_iterator *si_p, tree expr)
convert_to_gimple_builtin (block_stmt_iterator *si_p, tree expr, bool ignore)
{
tree_stmt_iterator ti;
tree stmt = bsi_stmt (*si_p);
tree tmp, stmts = NULL;
push_gimplify_context ();
tmp = get_initialized_tmp_var (expr, &stmts, NULL);
if (ignore)
{
tmp = build_empty_stmt ();
gimplify_and_add (expr, &stmts);
}
else
tmp = get_initialized_tmp_var (expr, &stmts, NULL);
pop_gimplify_context (NULL);
if (EXPR_HAS_LOCATION (stmt))
@ -2551,7 +2558,9 @@ execute_fold_all_builtins (void)
if (!set_rhs (stmtp, result))
{
result = convert_to_gimple_builtin (&i, result);
result = convert_to_gimple_builtin (&i, result,
TREE_CODE (old_stmt)
!= MODIFY_EXPR);
if (result)
{
bool ok = set_rhs (stmtp, result);