From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100322 invoked by alias); 14 Jul 2017 17:18:10 -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 100297 invoked by uid 89); 14 Jul 2017 17:18:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*Ad:U*wilson X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 14 Jul 2017 17:18:05 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 73DF2547FAF; Fri, 14 Jul 2017 19:18:02 +0200 (CEST) Date: Fri, 14 Jul 2017 17:18:00 -0000 From: Jan Hubicka To: Nathan Sidwell Cc: GCC Patches , Jason Merrill , Richard Guenther , Jim Wilson Subject: Re: [PATCH] Kill TYPE_METHODS ipa 2/9 Message-ID: <20170714171802.GA81461@kam.mff.cuni.cz> References: <8377f2cd-577c-60b2-63ac-f2619ebe63aa@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2017-07/txt/msg00857.txt.bz2 > This patch changes ipa-devirt. It contains a loop checking all the member > functions are 'the same'. However, as the comment says, we've already > zapped TYPE_METHODS, so the loop is never entered. I've added equivalent > zapping in this patch series, as the rationale appears to be reducing memory > footprint. It didn't seem appropriate to merge into the TYPE_FIELDS loop, > given it's never exercised. > > I'd appreciate review. > > nathan > > -- > Nathan Sidwell > 2017-07-14 Nathan Sidwell > > gcc/ > * ipa-devirt.c (odr_types_equivalent_p): Delete TYPE_METHODS scan. OK (we get virtual methods checked for match by comparing virtual tables, methods of same name are ODR checked, so we only miss diagnostics when one unit defines non-virtual method while other doesn't. It would be nice to check this, too, but there are cheaper ways of doing this) Honza > > Index: gcc/ipa-devirt.c > =================================================================== > --- gcc/ipa-devirt.c (revision 250160) > +++ gcc/ipa-devirt.c (working copy) > @@ -1602,62 +1602,6 @@ odr_types_equivalent_p (tree t1, tree t2 > > return false; > } > - if ((TYPE_MAIN_VARIANT (t1) == t1 || TYPE_MAIN_VARIANT (t2) == t2) > - && COMPLETE_TYPE_P (TYPE_MAIN_VARIANT (t1)) > - && COMPLETE_TYPE_P (TYPE_MAIN_VARIANT (t2)) > - && odr_type_p (TYPE_MAIN_VARIANT (t1)) > - && odr_type_p (TYPE_MAIN_VARIANT (t2)) > - && (TYPE_METHODS (TYPE_MAIN_VARIANT (t1)) > - != TYPE_METHODS (TYPE_MAIN_VARIANT (t2)))) > - { > - /* Currently free_lang_data sets TYPE_METHODS to error_mark_node > - if it is non-NULL so this loop will never realy execute. */ > - if (TYPE_METHODS (TYPE_MAIN_VARIANT (t1)) != error_mark_node > - && TYPE_METHODS (TYPE_MAIN_VARIANT (t2)) != error_mark_node) > - for (f1 = TYPE_METHODS (TYPE_MAIN_VARIANT (t1)), > - f2 = TYPE_METHODS (TYPE_MAIN_VARIANT (t2)); > - f1 && f2 ; f1 = DECL_CHAIN (f1), f2 = DECL_CHAIN (f2)) > - { > - if (DECL_ASSEMBLER_NAME (f1) != DECL_ASSEMBLER_NAME (f2)) > - { > - warn_odr (t1, t2, f1, f2, warn, warned, > - G_("a different method of same type " > - "is defined in another " > - "translation unit")); > - return false; > - } > - if (DECL_VIRTUAL_P (f1) != DECL_VIRTUAL_P (f2)) > - { > - warn_odr (t1, t2, f1, f2, warn, warned, > - G_("a definition that differs by virtual " > - "keyword in another translation unit")); > - return false; > - } > - if (DECL_VINDEX (f1) != DECL_VINDEX (f2)) > - { > - warn_odr (t1, t2, f1, f2, warn, warned, > - G_("virtual table layout differs " > - "in another translation unit")); > - return false; > - } > - if (odr_subtypes_equivalent_p (TREE_TYPE (f1), > - TREE_TYPE (f2), visited, > - loc1, loc2)) > - { > - warn_odr (t1, t2, f1, f2, warn, warned, > - G_("method with incompatible type is " > - "defined in another translation unit")); > - return false; > - } > - } > - if ((f1 == NULL) != (f2 == NULL)) > - { > - warn_odr (t1, t2, NULL, NULL, warn, warned, > - G_("a type with different number of methods " > - "is defined in another translation unit")); > - return false; > - } > - } > } > break; > }