Commit 5755cd38 by Jason Merrill Committed by Jason Merrill

alias.c (get_alias_set): Return a previously calculated alias set for a VAR_DECL.

        * alias.c (get_alias_set): Return a previously calculated
        alias set for a VAR_DECL.
        * function.c (gen_mem_addressof): Calculate the alias set before
        touching the RTL.

From-SVN: r44720
parent 0f0138b6
2001-08-08 Jason Merrill <jason_merrill@redhat.com>
* alias.c (get_alias_set): Return a previously calculated
alias set for a VAR_DECL.
* function.c (gen_mem_addressof): Calculate the alias set before
touching the RTL.
Wed Aug 8 18:44:37 CEST 2001 Jan Hubicka <jh@suse.cz> Wed Aug 8 18:44:37 CEST 2001 Jan Hubicka <jh@suse.cz>
* predict.def: Set hitrates according our experimental run. * predict.def: Set hitrates according our experimental run.
......
...@@ -526,6 +526,13 @@ get_alias_set (t) ...@@ -526,6 +526,13 @@ get_alias_set (t)
return 0; return 0;
} }
/* If we've already determined the alias set for this decl, just
return it. This is necessary for C++ anonymous unions, whose
component variables don't look like union members (boo!). */
if (TREE_CODE (t) == VAR_DECL
&& DECL_RTL_SET_P (t) && GET_CODE (DECL_RTL (t)) == MEM)
return MEM_ALIAS_SET (DECL_RTL (t));
/* Give the language another chance to do something special. */ /* Give the language another chance to do something special. */
if (orig_t != t if (orig_t != t
&& (set = lang_get_alias_set (t)) != -1) && (set = lang_get_alias_set (t)) != -1)
......
...@@ -2857,6 +2857,9 @@ gen_mem_addressof (reg, decl) ...@@ -2857,6 +2857,9 @@ gen_mem_addressof (reg, decl)
rtx r = gen_rtx_ADDRESSOF (Pmode, gen_reg_rtx (GET_MODE (reg)), rtx r = gen_rtx_ADDRESSOF (Pmode, gen_reg_rtx (GET_MODE (reg)),
REGNO (reg), decl); REGNO (reg), decl);
/* Calculate this before we start messing with decl's RTL. */
HOST_WIDE_INT set = get_alias_set (decl);
/* If the original REG was a user-variable, then so is the REG whose /* If the original REG was a user-variable, then so is the REG whose
address is being taken. Likewise for unchanging. */ address is being taken. Likewise for unchanging. */
REG_USERVAR_P (XEXP (r, 0)) = REG_USERVAR_P (reg); REG_USERVAR_P (XEXP (r, 0)) = REG_USERVAR_P (reg);
...@@ -2874,7 +2877,7 @@ gen_mem_addressof (reg, decl) ...@@ -2874,7 +2877,7 @@ gen_mem_addressof (reg, decl)
PUT_MODE (reg, decl_mode); PUT_MODE (reg, decl_mode);
MEM_VOLATILE_P (reg) = TREE_SIDE_EFFECTS (decl); MEM_VOLATILE_P (reg) = TREE_SIDE_EFFECTS (decl);
MEM_SET_IN_STRUCT_P (reg, AGGREGATE_TYPE_P (type)); MEM_SET_IN_STRUCT_P (reg, AGGREGATE_TYPE_P (type));
set_mem_alias_set (reg, get_alias_set (decl)); set_mem_alias_set (reg, set);
if (TREE_USED (decl) || DECL_INITIAL (decl) != 0) if (TREE_USED (decl) || DECL_INITIAL (decl) != 0)
fixup_var_refs (reg, GET_MODE (reg), TREE_UNSIGNED (type), 0); fixup_var_refs (reg, GET_MODE (reg), TREE_UNSIGNED (type), 0);
......
// Test that type punning using an anonymous union works with strict aliasing. // Test that type punning using an anonymous union works with strict aliasing.
// { dg-do run { xfail *-*-* } } // { dg-do run }
// { dg-options "-O2 -fstrict-aliasing" } // { dg-options "-O2 -fstrict-aliasing" }
extern "C" void abort (); extern "C" void abort ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment