From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15372 invoked by alias); 7 Apr 2015 20:37:37 -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 15363 invoked by uid 89); 7 Apr 2015 20:37:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 07 Apr 2015 20:37:36 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 6110C540AFB; Tue, 7 Apr 2015 22:37:33 +0200 (CEST) Date: Tue, 07 Apr 2015 20:37:00 -0000 From: Jan Hubicka To: Ilya Enkovich Cc: gcc-patches@gcc.gnu.org, hubicka@ucw.cz Subject: Re: [PATCH] Walk through thunks when propagating comdat group Message-ID: <20150407203733.GB91010@kam.mff.cuni.cz> References: <20150407143501.GD11622@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150407143501.GD11622@msticlxl57.ims.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2015-04/txt/msg00283.txt.bz2 > Hi, > > Currently enqueue_references in comdats pass enqueue target function instead of thunks. But propagate_comdat_group doesn't walk through thunks and therefore comdat group of thunk's caller is not propagated into thunk's target function. This patch tries to fix it. Testing is in progress. Does it look OK? > > Thanks, > Ilya > -- > gcc/ > > 2015-04-07 Ilya Enkovich > > * ipa-comdats.c (propagate_comdat_group): Walk through thunks. > > gcc/testsuite/ > > 2015-04-07 Ilya Enkovich > > * gcc.target/i386/mpx/chkp-thunk-comdat-3.c: New. > > > diff --git a/gcc/ipa-comdats.c b/gcc/ipa-comdats.c > index f349f9f..74088a9 100644 > --- a/gcc/ipa-comdats.c > +++ b/gcc/ipa-comdats.c > @@ -144,10 +144,12 @@ propagate_comdat_group (struct symtab_node *symbol, > > /* If we see inline clone, its comdat group actually > corresponds to the comdat group of the function it is inlined > - to. */ > + to. Dive into thunks similar to aliases. */ > > if (cgraph_node * cn = dyn_cast (symbol2)) > { > + if (cn->thunk.thunk_p) > + newgroup = propagate_comdat_group (symbol2, newgroup, map); OK, thanks! Please put the comment about inline clones just before the global.inlined_to test and make the comment about thunks separate. Probably "Thunks can not call across section boundary" Honza > if (cn->global.inlined_to) > symbol2 = cn->global.inlined_to; > } > diff --git a/gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-3.c b/gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-3.c > new file mode 100644 > index 0000000..dd0057e > --- /dev/null > +++ b/gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-3.c > @@ -0,0 +1,23 @@ > +/* { dg-do compile } */ > +/* { dg-options "-fcheck-pointer-bounds -mmpx -O -fvisibility=hidden" } */ > + > +int val; > + > +static int __attribute__((noinline)) > +test1 () > +{ > + return val; > +} > + > +static int __attribute__((bnd_legacy,noinline)) > +test2 () > +{ > + return test1 (); > +} > + > +int > +test3 (void) > +{ > + return test2 (); > +} > +