expr.c (expand_expr): Only set MEM_IN_STRUCT_P if the memory address is not varying...
authorJeffrey A Law <law@cygnus.com>
Mon, 13 Jul 1998 09:26:59 +0000 (09:26 +0000)
committerJeff Law <law@gcc.gnu.org>
Mon, 13 Jul 1998 09:26:59 +0000 (03:26 -0600)
        * expr.c (expand_expr): Only set MEM_IN_STRUCT_P if the memory address
        is not varying for REFERENCE_TYPE or when we think we might have found
        an optimized access to the first element in an array.

From-SVN: r21099

gcc/ChangeLog
gcc/expr.c

index 2ea15267abbd9cb87a3369d3ee102ffe6f596639..20b221d9aaec9f2ca08ebe6105c81ce92cad578a 100644 (file)
@@ -1,3 +1,9 @@
+Mon Jul 13 10:19:00 1998  Jeffrey A Law  (law@cygnus.com)
+
+       * expr.c (expand_expr): Only set MEM_IN_STRUCT_P if the memory address
+       is not varying for REFERENCE_TYPE or when we think we might have found
+       an optimized access to the first element in an array.
+
 Mon Jul 13 02:24:08 1998  David S. Miller  <davem@pierdol.cobaltmicro.com>
 
        * regclass.c (reg_scan_mark_refs): New arg min_regno.  Only update
index b9c0e1812443daf54421d3d35a2c53eab2975b02..ceb537e721ed9c784ae5f4388b5153685fdd0bf9 100644 (file)
@@ -5836,23 +5836,30 @@ expand_expr (exp, target, tmode, modifier)
            || (TREE_CODE (exp1) == SAVE_EXPR
                && TREE_CODE (TREE_OPERAND (exp1, 0)) == PLUS_EXPR)
            || AGGREGATE_TYPE_P (TREE_TYPE (exp))
-           /* If the pointer is actually a REFERENCE_TYPE, this could
-              be pointing into some aggregate too.  */
-           || TREE_CODE (TREE_TYPE (exp1)) == REFERENCE_TYPE
            || (TREE_CODE (exp1) == ADDR_EXPR
                && (exp2 = TREE_OPERAND (exp1, 0))
-               && AGGREGATE_TYPE_P (TREE_TYPE (exp2)))
-           /* This may have been an array reference to the first element
-              that was optimized away from being an addition.  */
-           || (TREE_CODE (exp1) == NOP_EXPR
-               && ((TREE_CODE (TREE_TYPE (TREE_OPERAND (exp1, 0)))
-                    == REFERENCE_TYPE)
-                   || ((TREE_CODE (TREE_TYPE (TREE_OPERAND (exp1, 0)))
-                        == POINTER_TYPE)
-                       && (AGGREGATE_TYPE_P
-                           (TREE_TYPE (TREE_TYPE
-                                       (TREE_OPERAND (exp1, 0)))))))))
+               && AGGREGATE_TYPE_P (TREE_TYPE (exp2))))
          MEM_IN_STRUCT_P (temp) = 1;
+
+       /* If the pointer is actually a REFERENCE_TYPE, this could be pointing
+          into some aggregate too.  In theory we could fold this into the
+          previous check and use rtx_addr_varies_p there too.
+
+          However, this seems safer.  */
+       if (!MEM_IN_STRUCT_P (temp)
+           && (TREE_CODE (TREE_TYPE (exp1)) == REFERENCE_TYPE
+               /* This may have been an array reference to the first element
+                  that was optimized away from being an addition.  */
+               || (TREE_CODE (exp1) == NOP_EXPR
+                   && ((TREE_CODE (TREE_TYPE (TREE_OPERAND (exp1, 0)))
+                        == REFERENCE_TYPE)
+                       || ((TREE_CODE (TREE_TYPE (TREE_OPERAND (exp1, 0)))
+                            == POINTER_TYPE)
+                           && (AGGREGATE_TYPE_P
+                               (TREE_TYPE (TREE_TYPE
+                                           (TREE_OPERAND (exp1, 0))))))))))
+         MEM_IN_STRUCT_P (temp) = ! rtx_addr_varies_p (temp);
+
        MEM_VOLATILE_P (temp) = TREE_THIS_VOLATILE (exp) | flag_volatile;
        MEM_ALIAS_SET (temp) = get_alias_set (exp);