From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120550 invoked by alias); 26 May 2015 13:51:35 -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 120534 invoked by uid 89); 26 May 2015 13:51:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.2 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; Tue, 26 May 2015 13:51:34 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D7BAAAD21; Tue, 26 May 2015 13:51:30 +0000 (UTC) Date: Tue, 26 May 2015 14:07:00 -0000 From: Michael Matz To: Jan Hubicka cc: gcc-patches@gcc.gnu.org, rguenther@suse.de Subject: Re: Do not compute alias sets for types that don't need them In-Reply-To: <20150522121552.GC91616@kam.mff.cuni.cz> Message-ID: References: <20150522121552.GC91616@kam.mff.cuni.cz> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg02337.txt.bz2 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.