From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57705 invoked by alias); 11 Apr 2017 14:21:41 -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 57398 invoked by uid 89); 11 Apr 2017 14:21:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= 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; Tue, 11 Apr 2017 14:21:38 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 6C278540A10; Tue, 11 Apr 2017 16:21:37 +0200 (CEST) Date: Tue, 11 Apr 2017 14:21:00 -0000 From: Jan Hubicka To: Martin =?iso-8859-2?Q?Li=B9ka?= Cc: GCC Patches , markus@trippelsdorf.de Subject: Re: [PATCH] Add function part to a same comdat group (PR ipa/80212). Message-ID: <20170411142137.GA92281@kam.mff.cuni.cz> References: <30a781ae-a0b1-1b69-4ba1-a8d5a737d8dc@suse.cz> <70c0fdca-478c-de73-aca5-a6ec022c6255@suse.cz> <5559245c-b654-dc71-1fdc-c3aeec75ca08@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5559245c-b654-dc71-1fdc-c3aeec75ca08@suse.cz> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2017-04/txt/msg00525.txt.bz2 > Hello. > > This is my second attempt to fix the PR I worked on with Honza and Martin Jambor. > > Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Apart from that > octoploid confirmed it can survive LLVM build. And I can build Firefox and boost with the > patch on x86_64-linux-gnu. > > Ready to be installed? > Martin > >From f8934791a3d345eb8c2c51beca07177c75e5f6ac Mon Sep 17 00:00:00 2001 > From: marxin > Date: Tue, 11 Apr 2017 14:22:50 +0200 > Subject: [PATCH] Add function part to a same comdat group (PR ipa/80212). > > gcc/ChangeLog: > > 2017-04-11 Martin Liska > > PR ipa/80212 > * cgraph.c (cgraph_node::dump): Dump calls_comdat_local. > * ipa-cp.c (determine_versionability): Handle calls_comdat_local > flags. > * ipa-split.c (split_function): Create a local comdat symbol > if caller is in a comdat group. > > gcc/testsuite/ChangeLog: > > 2017-04-11 Martin Liska > > PR ipa/80212 > * g++.dg/ipa/pr80212.C: New test. > --- > gcc/cgraph.c | 2 ++ > gcc/ipa-cp.c | 2 ++ > gcc/ipa-split.c | 7 +++++++ > gcc/testsuite/g++.dg/ipa/pr80212.C | 18 ++++++++++++++++++ > 4 files changed, 29 insertions(+) > create mode 100644 gcc/testsuite/g++.dg/ipa/pr80212.C > > diff --git a/gcc/cgraph.c b/gcc/cgraph.c > index 92ae0910c60..e505b10e211 100644 > --- a/gcc/cgraph.c > +++ b/gcc/cgraph.c > @@ -2123,6 +2123,8 @@ cgraph_node::dump (FILE *f) > fprintf (f, " only_called_at_exit"); > if (tm_clone) > fprintf (f, " tm_clone"); > + if (calls_comdat_local) > + fprintf (f, " calls_comdat_local"); > if (icf_merged) > fprintf (f, " icf_merged"); > if (merged_comdat) > diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c > index 0b408149a88..756a335661d 100644 > --- a/gcc/ipa-cp.c > +++ b/gcc/ipa-cp.c > @@ -614,6 +614,8 @@ determine_versionability (struct cgraph_node *node, > decloned constructors, inlining is always better anyway. */ > else if (node->comdat_local_p ()) > reason = "comdat-local function"; > + else if (node->calls_comdat_local) > + reason = "calls comdat-local function"; Perhaps add a comment here that the call is versionable if we make sure that all callers are inside of the comdat group. We could improve it later if it becomes important. > > if (reason && dump_file && !node->alias && !node->thunk.thunk_p) > fprintf (dump_file, "Function %s/%i is not versionable, reason: %s.\n", > diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c > index da3c2c62344..8993cae089c 100644 > --- a/gcc/ipa-split.c > +++ b/gcc/ipa-split.c > @@ -1360,6 +1360,13 @@ split_function (basic_block return_bb, struct split_point *split_point, > > node->split_part = true; > > + if (cur_node->same_comdat_group) > + { > + cur_node->calls_comdat_local = 1; > + node->add_to_same_comdat_group (cur_node); > + } Also please add a comment here as well. Otherwise OK. I would suggest commit the first part (fixing comdat local handling) first and ipa-split bits incrementally to simplify bisecting we may need to do in future (I hope we won't) Honza