diff options
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/builtins.c | 2 | ||||
-rw-r--r-- | gcc/gimplify.c | 2 | ||||
-rw-r--r-- | gcc/tree-ssa-ccp.c | 17 |
4 files changed, 23 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0ebad7c..eee8ad3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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): diff --git a/gcc/builtins.c b/gcc/builtins.c index 694185d..fec89cc 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -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; diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 41486f1..fedc284 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -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)); diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 8c31a86..3be926d 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -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); |