From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30915 invoked by alias); 4 Sep 2013 16:04:14 -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 30906 invoked by uid 89); 4 Sep 2013 16:04:13 -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, 04 Sep 2013 16:04:13 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 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 93B8E542F56; Wed, 4 Sep 2013 18:04:09 +0200 (CEST) Date: Wed, 04 Sep 2013 16:04:00 -0000 From: Jan Hubicka To: gcc-patches@gcc.gnu.org, jason@redhat.com, rguenther@suse.de Subject: [RFC] Fix for PR58201 Message-ID: <20130904160409.GF20687@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-SW-Source: 2013-09/txt/msg00229.txt.bz2 Hi, this is third fallout of my change to remove DECL_ARGUMENTS/DECL_RESULT for functions w/o bodies I did not really anticipate. Here removal of the arguments changes mangling algorithm if set_decl_assembler_name is invoked late. This is something I wanted to get rid of for a long time: we already compute assembler names for every symbol that lands symbol table after the early cleanups for every unit that is LTOed and every unit containing any alias directive. I think it will make things smoother if we computed it always early: other persistent source of problems are same body aliases that are created as a side effect of langhook of set_decl_assembler_name and that may happen at a time IPA code does not really expect new functions/variables to appear. So independently of DECL_ARGUMENTS/DECL_RESULT issues, I would like to propose the following patch that triggers unconditional computation of DECL_ASSEMBLER_NAME and the real symbol table construction. I already benchmarked it few months ago and the erformance implications seems in wash. Just to keep things linked, the other two fallouts are 1) problem with thunks needing DECL_ARGUMENTS when they are output in gimple way but these are not streamed, handled by http://gcc.gnu.org/ml/gcc-patches/2013-09/msg00057.html 2) problem with variable sized arguments and return values "fixed" by http://gcc.gnu.org/ml/gcc-patches/2013-09/msg00078.html (the fix restored old behaviour, but I do not think it fixes the whole issue as discussed in the thread and provided with another testcases that ICEs the compiler independently of my changes). I would like to basically ask if it seems to make sense to go this route and try to get rid of those declarations. For LTO it is really nice optimization - instead of streaming 4 decls at average for a function (function-decl, result-decl and parm-decls), we need just one. This change was originally motivated by memory analysis of firefox WPA build where PARM_DECL was the most common type of tree just after TREE_LIST. I also think it makes sense from backend point of view to consider these part of the function body representation, just as DECL_STRUCT_FUNCTOIN and DECL_INITIAL is. Even in non-LTO we save a lot of decls for all the external declarations that are kept in memory. I would be willing to try to analyze/fix the issues if they appear and I tried quite curefuly to examine the existing code dealing with arguments. There are obviously interesting scenarios, like this mangling issue, I missed. If this does not seem to make sense, I will prepare patch to revert the changes. If it does, I will commit those fixes and hope things will stabilize quickly. Honza * cgraphunit.c (analyze_functions): Populate assembler names once done with early unreachable function removal. Index: cgraphunit.c =================================================================== --- cgraphunit.c (revision 202199) +++ cgraphunit.c (working copy) @@ -1074,6 +1086,7 @@ bitmap_obstack_release (NULL); pointer_set_destroy (reachable_call_targets); ggc_collect (); + symtab_initialize_asm_name_hash (); } /* Translate the ugly representation of aliases as alias pairs into nice