From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19326 invoked by alias); 22 May 2008 12:49:11 -0000 Received: (qmail 19208 invoked by uid 48); 22 May 2008 12:48:27 -0000 Date: Thu, 22 May 2008 12:49:00 -0000 Message-ID: <20080522124827.19207.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug tree-optimization/36291] GCC is slow and memory-hungry building sipQtGuipart.cpp In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-05/txt/msg01700.txt.bz2 ------- Comment #3 from rguenth at gcc dot gnu dot org 2008-05-22 12:48 ------- The root of all evil is the following code in add_referenced_var(): /* Scan DECL_INITIAL for pointer variables as they may contain address arithmetic referencing the address of other variables. Even non-constant intializers need to be walked, because IPA passes might prove that their are invariant later on. */ if (DECL_INITIAL (var) /* Initializers of external variables are not useful to the optimizers. */ && !DECL_EXTERNAL (var)) walk_tree (&DECL_INITIAL (var), find_vars_r, NULL, 0); this causes us to basically add all globals to all functions referenced vars once they reference one of the chained structs. We shouldn't be doing this but instead who needs those vars should add them. I suppose the IPA passes thing is just the lack of a global DECL_UID to tree mapping. So I am going to try to change the above to /* Scan DECL_INITIAL for pointer variables as they may contain address arithmetic referencing the address of other variables. As we are only interested in directly referenced globals or referenced locals restrict this to initializers than can refer to local variables. */ if (DECL_INITIAL (var) && DECL_CONTEXT (var) == current_function_decl) walk_tree (&DECL_INITIAL (var), find_vars_r, NULL, 0); This gets memory usage down to about 700MB and compile time down to 50s. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu dot | |org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2008-05-22 12:48:27 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36291