From: Jeffrey A Law Date: Mon, 13 Jul 1998 09:26:59 +0000 (+0000) Subject: expr.c (expand_expr): Only set MEM_IN_STRUCT_P if the memory address is not varying... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b5f881570be51f9c67780802e7e8627a62c8a1de;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2ea15267abb..20b221d9aae 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 * regclass.c (reg_scan_mark_refs): New arg min_regno. Only update diff --git a/gcc/expr.c b/gcc/expr.c index b9c0e181244..ceb537e721e 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);