This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Do not compute alias sets for types that don't need them
- From: Michael Matz <matz at suse dot de>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: gcc-patches at gcc dot gnu dot org, rguenther at suse dot de
- Date: Tue, 26 May 2015 15:51:30 +0200 (CEST)
- Subject: Re: Do not compute alias sets for types that don't need them
- Authentication-results: sourceware.org; auth=none
- References: <20150522121552 dot GC91616 at kam dot mff dot cuni dot cz>
Hi,
On Fri, 22 May 2015, Jan Hubicka wrote:
> Index: tree-streamer-out.c
> ===================================================================
> --- tree-streamer-out.c (revision 223508)
> +++ tree-streamer-out.c (working copy)
> @@ -346,6 +346,7 @@ pack_ts_type_common_value_fields (struct
> alias-set zero to this type. */
> bp_pack_var_len_int (bp, (TYPE_ALIAS_SET (expr) == 0
> || (!in_lto_p
> + && type_with_alias_set_p (expr)
> && get_alias_set (expr) == 0)) ? 0 : -1);
I find such interfaces very ugly. IOW, when it's always (or often)
necessary to call check_foo_p() before foo() can be called then the
checking should be part of foo() (and it should then return a conservative
value, i.e. alias set 0), and that requirement not be imposed on the
callers of foo(). I.e. why can't whatever checks you do in
type_with_alias_set_p be included in get_alias_set?
> + front-end routine) and use it.
> +
> + We may be called to produce MEM RTX for variable of incomplete type.
> + This MEM RTX will only be used to produce address of a vairable, so
> + we do not need to compute alias set. */
> + if (!DECL_P (t) || type_with_alias_set_p (TYPE_MAIN_VARIANT (TREE_TYPE (t))))
> + attrs.alias = get_alias_set (t);
And if the checking needs to go down the main-variant chain then this
should be done inside type_with_alias_set_p(), not in the caller,
otherwise even the symmetry between arguments of type_with_alias_set_p(xy)
and get_alias_set(xy) is destroyed (but see above for why I think
type_with_alias_set_p shouldn't even exist).
Ciao,
Michael.