* c-common.c (c_expand_expr): Remove code to return a value
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 31 Dec 2003 18:41:28 +0000 (18:41 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 31 Dec 2003 18:41:28 +0000 (18:41 +0000)
different from that returned by expand_expr.
* expr.c (store_expr): Use the validity of a target MEM, rather
than checking DECL_RTL (exp), to figure out if a copy is
required.

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

gcc/ChangeLog
gcc/c-common.c
gcc/expr.c

index c747054..b27cd4c 100644 (file)
@@ -1,3 +1,11 @@
+2003-12-31  Mark Mitchell  <mark@codesourcery.com>
+
+       * c-common.c (c_expand_expr): Remove code to return a value
+       different from that returned by expand_expr.
+       * expr.c (store_expr): Use the validity of a target MEM, rather
+       than checking DECL_RTL (exp), to figure out if a copy is
+       required.
+
 2003-12-31  Kazu Hirata  <kazu@cs.umass.edu>
 
        * config/v850/lib1funcs.asm: Fix comment formatting.
index 3ba73dd..327a4dc 100644 (file)
@@ -4064,7 +4064,6 @@ c_expand_expr (tree exp, rtx target, enum machine_mode tmode, int modifier)
        tree rtl_expr;
        rtx result;
        bool preserve_result = false;
-       bool return_target = false;
 
        if (STMT_EXPR_WARN_UNUSED_RESULT (exp) && target == const0_rtx)
          {
@@ -4112,20 +4111,10 @@ c_expand_expr (tree exp, rtx target, enum machine_mode tmode, int modifier)
            if (TREE_CODE (last) == SCOPE_STMT
                && TREE_CODE (expr) == EXPR_STMT)
              {
-               if (target && TREE_CODE (EXPR_STMT_EXPR (expr)) == VAR_DECL
-                   && DECL_RTL_IF_SET (EXPR_STMT_EXPR (expr)) == target)
-                 /* If the last expression is a variable whose RTL is the
-                    same as our target, just return the target; if it
-                    isn't valid expanding the decl would produce different
-                    RTL, and store_expr would try to do a copy.  */
-                 return_target = true;
-               else
-                 {
-                   /* Otherwise, note that we want the value from the last
-                      expression.  */
-                   TREE_ADDRESSABLE (expr) = 1;
-                   preserve_result = true;
-                 }
+               /* Otherwise, note that we want the value from the last
+                  expression.  */
+               TREE_ADDRESSABLE (expr) = 1;
+               preserve_result = true;
              }
          }
 
@@ -4133,9 +4122,7 @@ c_expand_expr (tree exp, rtx target, enum machine_mode tmode, int modifier)
        expand_end_stmt_expr (rtl_expr);
 
        result = expand_expr (rtl_expr, target, tmode, modifier);
-       if (return_target)
-         result = target;
-       else if (preserve_result && GET_CODE (result) == MEM)
+       if (preserve_result && GET_CODE (result) == MEM)
          {
            if (GET_MODE (result) != BLKmode)
              result = copy_to_reg (result);
index 93ab7e0..a38dee1 100644 (file)
@@ -4253,11 +4253,13 @@ store_expr (tree exp, rtx target, int want_value)
                              || side_effects_p (target))))
       && TREE_CODE (exp) != ERROR_MARK
       && ! dont_store_target
-        /* If store_expr stores a DECL whose DECL_RTL(exp) == TARGET,
-           but TARGET is not valid memory reference, TEMP will differ
-           from TARGET although it is really the same location.  */
-      && (TREE_CODE_CLASS (TREE_CODE (exp)) != 'd'
-         || target != DECL_RTL_IF_SET (exp))
+      /* If store_expr stores a DECL whose DECL_RTL(exp) == TARGET,
+        but TARGET is not valid memory reference, TEMP will differ
+        from TARGET although it is really the same location.  */
+      && !(GET_CODE (target) == MEM
+          && GET_CODE (XEXP (target, 0)) != QUEUED
+          && (!memory_address_p (GET_MODE (target), XEXP (target, 0))
+              || (flag_force_addr && !REG_P (XEXP (target, 0)))))
       /* If there's nothing to copy, don't bother.  Don't call expr_size
         unless necessary, because some front-ends (C++) expr_size-hook
         aborts on objects that are not supposed to be bit-copied or