aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>1998-07-13 09:26:59 +0000
committerJeff Law <law@gcc.gnu.org>1998-07-13 03:26:59 -0600
commitb5f881570be51f9c67780802e7e8627a62c8a1de (patch)
treea0cbab974a5039faeee315e4122850b6a7d4fa72 /gcc
parentbda991ee5e88baded69529b5c9271bba6c7399bc (diff)
downloadgcc-b5f881570be51f9c67780802e7e8627a62c8a1de.zip
gcc-b5f881570be51f9c67780802e7e8627a62c8a1de.tar.gz
gcc-b5f881570be51f9c67780802e7e8627a62c8a1de.tar.bz2
expr.c (expand_expr): Only set MEM_IN_STRUCT_P if the memory address is not varying for...
* 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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/expr.c35
2 files changed, 27 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2ea1526..20b221d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/expr.c b/gcc/expr.c
index b9c0e18..ceb537e 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -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);