From patchwork Sat Dec 11 17:00:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 75201 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]) by ozlabs.org (Postfix) with SMTP id AEEC6B70A7 for ; Sun, 12 Dec 2010 04:00:17 +1100 (EST) Received: (qmail 891 invoked by alias); 11 Dec 2010 17:00:13 -0000 Received: (qmail 874 invoked by uid 22791); 11 Dec 2010 17:00:10 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from nikam-dmz.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 11 Dec 2010 17:00:05 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id A799C9ACABE; Sat, 11 Dec 2010 18:00:02 +0100 (CET) Date: Sat, 11 Dec 2010 18:00:02 +0100 From: Jan Hubicka To: John David Anglin Cc: Jan Hubicka , ro@CeBiTec.Uni-Bielefeld.DE, gcc-patches@gcc.gnu.org, jh@suse.cz, dave.anglin@nrc-cnrc.gc.ca, ni1d@arrl.net Subject: Re: Restore Tru64 UNIX bootstrap (PR middle-end/46671) Message-ID: <20101211170002.GB8468@kam.mff.cuni.cz> References: <20101211160419.GA7653@kam.mff.cuni.cz> <20101211165100.D3B8A4CFC@hiauly1.hia.nrc.ca> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20101211165100.D3B8A4CFC@hiauly1.hia.nrc.ca> User-Agent: Mutt/1.5.18 (2008-05-17) 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 > > I lost the flag_reorder_functions check in my patch, will add it back into > > default_function_section and dwarf2_function_section code. > > Ah, that explains why I started seeing the sections associated with > section reordering in default compilations without options. -freorder-functions is now declared as { OPT_LEVELS_2_PLUS, OPT_freorder_functions, NULL, 1 }, I do not see why this should not be default for -O1 too - it is cheap compilation time wise. I am attaching the fix for flag_reorder_functions I intend to commit tonight as obvious if there are no complains > > We previously (4.5 branch) had the following code in choose_function_section: > > if (DECL_SECTION_NAME (current_function_decl) > || !targetm.have_named_sections > /* Theoretically we can split the gnu.linkonce text section too, > but this requires more work as the frequency needs to match > for all generated objects so we need to merge the frequency > of all instances. For now just never set frequency for these. */ > || DECL_ONE_ONLY (current_function_decl)) > return; I see, I missed the targetm.have_named_sections. I guess the proposed patch still makes sense in this context. > > /* If we are doing the partitioning optimization, let the optimization > choose the correct section into which to put things. */ > > if (flag_reorder_blocks_and_partition) > return; > > It appears functions with a named section are correctly handled by the > new code by name concatenation. Don't know about DECL_ONE_ONLY and > flag_reorder_blocks_and_partition (latter is disabled on PA). The concatenation code comes from flag_reorder_blocks_and_partition code. there is code checking if -freorder-blocks-and-partition is supposed and it also uses the targetm.have_named_sections. So I suppose on named section targets we did the renaming. I am however not too opposed to making this default for ELF systems only. We already handle this specially on darwin, that leaves us with cygwin as a target where we probably really care? Honza * varasm.c (default_function_section): Return NULL when flag_reorder_functions is disabled. * darwin.c (darwin_function_section): Likewise. Index: varasm.c =================================================================== --- varasm.c (revision 167472) +++ varasm.c (working copy) @@ -533,6 +533,8 @@ section * default_function_section (tree decl, enum node_frequency freq, bool startup, bool exit) { + if (!flag_reorder_functions) + return NULL; /* Startup code should go to startup subsection unless it is unlikely executed (this happens especially with function splitting where we can split away unnecesary parts of static constructors. */ Index: config/darwin.c =================================================================== --- config/darwin.c (revision 167472) +++ config/darwin.c (working copy) @@ -2970,6 +2970,8 @@ section * darwin_function_section (tree decl, enum node_frequency freq, bool startup, bool exit) { + if (!flag_reorder_functions) + return NULL; /* Startup code should go to startup subsection unless it is unlikely executed (this happens especially with function splitting where we can split away unnecesary parts of static constructors. */