From patchwork Wed Aug 28 17:23:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 270609 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "www.sourceware.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id D854A2C00BF for ; Thu, 29 Aug 2013 03:23:29 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=njY4yUNHtZpPB42CE 52ErBqJjZNj/k+QfP9+XE0OUgD1Y5wpz07yliU9mqCP/NXrViwSiH4UXjbGWXLV7 2DnE4aepaYZUUI77rBRSICrmY1reIUR6mnc2ZC2aDB8lOFBA6sneWNjl36v0Q/JH XBJj+tdwjUgk+Jx71QSh0DTm1Q= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=ru/ai4nvp+zBBWXZQCloOcJ ROk8=; b=w6oJI9h5jjDvvvEAcf3bJKsfcamddlqbxOGCtqs/F4bYVtRA3e9T2l3 KJD0dzIoF6OSiL/CVbiE7F5pV4eoUKdIZ/ttPgfWUE31A4Rt1G2idNwGCjaCA+rn e86lploaibm79ue4pB+Fdmhfx136C0nkIamamFjetLcUfRUg9kAg= Received: (qmail 15986 invoked by alias); 28 Aug 2013 17:23:23 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 15974 invoked by uid 89); 28 Aug 2013 17:23:22 -0000 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-SHA encrypted) ESMTPS; Wed, 28 Aug 2013 17:23:22 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, NO_RELAYS autolearn=ham version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 2CA46543B57; Wed, 28 Aug 2013 19:23:19 +0200 (CEST) Date: Wed, 28 Aug 2013 19:23:19 +0200 From: Jan Hubicka To: Jason Merrill Cc: Jan Hubicka , gcc-patches@gcc.gnu.org Subject: Re: Make some comdats implicitly hidden Message-ID: <20130828172318.GB3513@kam.mff.cuni.cz> References: <20130826195724.GB13069@kam.mff.cuni.cz> <521BFB17.5000902@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <521BFB17.5000902@redhat.com> User-Agent: Mutt/1.5.20 (2009-06-14) > On 08/26/2013 03:57 PM, Jan Hubicka wrote: > >While analyzing the relocations of libreoffice I noticed that I can play > >the same game w/o LTO at linker level. Making those symbols hidden truns > >external relocations to internal and should improve runtime, too: comdat > >sharing by dynamic linker is expensive and won't save duplicated functions > >from the binary. > > Makes sense. > > >There is ext/visibility/template2.C that fails with the patch. It tests that > >visibility pragma does not bring the symbol local, but now we do so based > >on logic above. > > > >Jason, do you have any idea how to fix the testcase? I tried to use different > >visility but that doesn't work, since we do not have corresponding scan-not-* > > Maybe change it to use a function that has its address taken, so > this optimization doesn't apply. OK, thanks. This did not appear to me. Does the following look resonable? Index: testsuite/g++.dg/ext/visibility/template2.C =================================================================== --- testsuite/g++.dg/ext/visibility/template2.C (revision 202047) +++ testsuite/g++.dg/ext/visibility/template2.C (working copy) @@ -4,15 +4,16 @@ /* { dg-do compile } */ /* { dg-require-visibility "" } */ -/* { dg-final { scan-not-hidden "_ZN1SIiED1Ev" } } */ -/* { dg-final { scan-not-hidden "_ZN1SIiEC1ERKi" } } */ +/* { dg-final { scan-not-hidden "_ZN1SIiE9nothiddenEv" } } */ template struct S { S (const T &); + void nothidden(void); ~S (); T t; + void (S::* ptr) (void); }; template @@ -20,6 +21,13 @@ S::S (const T &x) { t = x; } +template +void +S::nothidden(void) +{ + if (t) + ptr=&S::nothidden; +} template S::~S () @@ -30,6 +38,6 @@ S::~S () struct U { S s; - U () : s (6) { } + U () : s (6) { s.nothidden();} } u; #pragma GCC visibility pop