From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46956 invoked by alias); 27 May 2015 08:28:33 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 46945 invoked by uid 89); 27 May 2015 08:28:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx2.suse.de Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Wed, 27 May 2015 08:28:31 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DAAD5AC20; Wed, 27 May 2015 08:28:28 +0000 (UTC) Date: Wed, 27 May 2015 08:39:00 -0000 From: Richard Biener To: Jan Hubicka cc: Michael Matz , gcc-patches@gcc.gnu.org Subject: Re: Do not compute alias sets for types that don't need them In-Reply-To: <20150526173450.GD43680@kam.mff.cuni.cz> Message-ID: References: <20150522121552.GC91616@kam.mff.cuni.cz> <20150526173450.GD43680@kam.mff.cuni.cz> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2015-05/txt/msg02395.txt.bz2 On Tue, 26 May 2015, Jan Hubicka wrote: > > 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? > > Because of sanity checking: I want to make alias sets of those types undefined > rather than having random values. The point is that using the alias set in > alias oracle querry is wrong. You could have just returned 0 for the alias-set for !type_with_alias_set_p in get_alias_set. That avoids polluting the alias data structures and is neither random or wrong. > Now I run into the case that we do produce MEM exprs for incomplete variants > just to take their address so I was thinking the other day about defining an > invalid alias set -2, making get_alias_set to return it and ICE later when query > is actually made? > > We do have wrong query problems at least in ipa-icf, so I think it is worthwhile > sanity check. > > > > > + 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). > > Yep, good point - I will cleanup this. > > Honza > > -- Richard Biener SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nuernberg)