From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 52383 invoked by alias); 3 Jun 2015 11:41:19 -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 52373 invoked by uid 89); 3 Jun 2015 11:41:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_50,KAM_ASCII_DIVIDERS,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, 03 Jun 2015 11:41:18 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 0BE60ADB3; Wed, 3 Jun 2015 11:41:15 +0000 (UTC) Date: Wed, 03 Jun 2015 11:41:00 -0000 From: Richard Biener To: Jan Hubicka cc: gcc-patches@gcc.gnu.org Subject: Re: Compute canonical type by main variants In-Reply-To: <20150530200421.GB83976@kam.mff.cuni.cz> Message-ID: References: <20150530200421.GB83976@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-06/txt/msg00305.txt.bz2 On Sat, 30 May 2015, Jan Hubicka wrote: > > Richard, > this patch makes canonical_type to be computed via the hash only for main > variants of types. The idea is to save some lookups because most types are > variants and should match. > > I also added sanity checking about that. > > Bootstrapped/regtested ppc-linux, OK? Ok. Thanks, Richard. > Honza > > * lto.c (iterative_hash_canonical_type, > gimple_register_canonical_type): only hash main variants of types > * tree.c (verify_type_variant): Verify that type and variant is > compatible. > (gimple_canonical_types_compatible_p): Look for main variants. > > Index: lto/lto.c > =================================================================== > --- lto/lto.c (revision 223883) > +++ lto/lto.c (working copy) > @@ -413,6 +413,9 @@ static void > iterative_hash_canonical_type (tree type, inchash::hash &hstate) > { > hashval_t v; > + > + /* All type variants have same TYPE_CANONICAL. */ > + type = TYPE_MAIN_VARIANT (type); > /* An already processed type. */ > if (TYPE_CANONICAL (type)) > { > @@ -498,7 +501,15 @@ gimple_register_canonical_type (tree t) > if (TYPE_CANONICAL (t) || !type_with_alias_set_p (t)) > return; > > - gimple_register_canonical_type_1 (t, hash_canonical_type (t)); > + /* Canonical types are same among all complete variants. */ > + if (TYPE_CANONICAL (TYPE_MAIN_VARIANT (t))) > + TYPE_CANONICAL (t) = TYPE_CANONICAL (TYPE_MAIN_VARIANT (t)); > + else > + { > + gimple_register_canonical_type_1 (TYPE_MAIN_VARIANT (t), > + hash_canonical_type (TYPE_MAIN_VARIANT (t))); > + TYPE_CANONICAL (t) = TYPE_CANONICAL (TYPE_MAIN_VARIANT (t)); > + } > } > > /* Re-compute TYPE_CANONICAL for NODE and related types. */ > Index: tree.c > =================================================================== > --- tree.c (revision 223883) > +++ tree.c (working copy) > @@ -12819,6 +12819,17 @@ verify_type_variant (const_tree t, tree > debug_tree (TREE_TYPE (t)); > return false; > } > + if (type_with_alias_set_p (t) > + && !gimple_canonical_types_compatible_p (t, tv, false)) > + { > + error ("type is not compatible with its vairant"); > + debug_tree (tv); > + error ("type variant's TREE_TYPE"); > + debug_tree (TREE_TYPE (tv)); > + error ("type's TREE_TYPE"); > + debug_tree (TREE_TYPE (t)); > + return false; > + } > return true; > #undef verify_variant_match > } > @@ -12843,7 +12854,13 @@ bool > gimple_canonical_types_compatible_p (const_tree t1, const_tree t2, > bool trust_type_canonical) > { > - /* Before starting to set up the SCC machinery handle simple cases. */ > + /* Type variants should be same as the main variant. When not doing sanity > + checking to verify this fact, go to main variants and save some work. */ > + if (trust_type_canonical) > + { > + t1 = TYPE_MAIN_VARIANT (t1); > + t2 = TYPE_MAIN_VARIANT (t2); > + } > > /* Check first for the obvious case of pointer identity. */ > if (t1 == t2) > > -- Richard Biener SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nuernberg)