+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):
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;
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));
\f
/* 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))
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);