OSDN Git Service

* builtins.c (fold_builtin): Don't generate NOP_EXPR that is going
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 Oct 2006 22:47:47 +0000 (22:47 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 Oct 2006 22:47:47 +0000 (22:47 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118091 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/builtins.c
gcc/gimplify.c
gcc/tree-ssa-ccp.c

index 0ebad7c..eee8ad3 100644 (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):
index 694185d..fec89cc 100644 (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;
index 41486f1..fedc284 100644 (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));
index 8c31a86..3be926d 100644 (file)
@@ -2465,17 +2465,24 @@ fold_stmt_inplace (tree stmt)
 \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))
@@ -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);