From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13526 invoked by alias); 9 Mar 2015 15:26:08 -0000 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 Received: (qmail 13450 invoked by uid 48); 9 Mar 2015 15:26:01 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/44563] GCC uses a lot of RAM when compiling a large numbers of functions Date: Mon, 09 Mar 2015 15:26:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.3.4 X-Bugzilla-Keywords: compile-time-hog, memory-hog X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-03/txt/msg00964.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44563 --- Comment #17 from Richard Biener --- (In reply to Richard Biener from comment #16) > callgrind shows the cgraph_edge_hasher quite high in the profile (via > redirect_all_calls). I suppose as the large main is a single BB walking > all stmts over-and-over is quite bad. Also hash_pointer isn't inlined!? > Ah - it's external in libiberty hashtab.c ... - it should transition to > using/inheriting from pointer_hash. > > cgraph_edge * > cgraph_node::get_edge (gimple call_stmt) > { > cgraph_edge *e, *e2; > int n = 0; > > if (call_site_hash) > return call_site_hash->find_with_hash (call_stmt, > htab_hash_pointer (call_stmt)); > Btw, for 10000 calls (smaller testcase) we get 100 000 000 calls to cgraph_edge::redirect_call_stmt_to_callee () (that's from 40000 redirect_all_calls calls which is from 10000 optimize_inline_calls calls). Ah - we do this also for the ENTRY/EXIT block! Index: gcc/tree-inline.c =================================================================== --- gcc/tree-inline.c (revision 221278) +++ gcc/tree-inline.c (working copy) @@ -2802,11 +2802,13 @@ copy_cfg_body (copy_body_data * id, gcov if (need_debug_cleanup && bb->index != ENTRY_BLOCK && bb->index != EXIT_BLOCK) - maybe_move_debug_stmts_to_successors (id, (basic_block) bb->aux); - /* Update call edge destinations. This can not be done before loop - info is updated, because we may split basic blocks. */ - if (id->transform_call_graph_edges == CB_CGE_DUPLICATE) - redirect_all_calls (id, (basic_block)bb->aux); + { + maybe_move_debug_stmts_to_successors (id, (basic_block) bb->aux); + /* Update call edge destinations. This can not be done before loop + info is updated, because we may split basic blocks. */ + if (id->transform_call_graph_edges == CB_CGE_DUPLICATE) + redirect_all_calls (id, (basic_block)bb->aux); + } ((basic_block)bb->aux)->aux = NULL; bb->aux = NULL; } makes sense? > The estimate_calls_size_and_time portion is quite smaller. > > cleanup-cfgs main portion is split_bb_on_noreturn_calls.