From 7114fb145ed8d21b5cd7f509281e8312cc6f11e7 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sun, 20 Aug 2006 18:46:54 +0000 Subject: PR middle-end/28779 * ipa-inline.c (cgraph_decide_inlining, cgraph_early_inlining): Compute function body sizes. * cgraphunit.c (cgraph_analyze_function): Don't do so. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@116274 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 ++++++++- gcc/cgraphunit.c | 3 ++- gcc/ipa-inline.c | 31 ++++++++++++++++++++++++------- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6104ecda4f8..3ab3aa0e962 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,11 @@ -006-08-20 Danny Smith +2006-08-20 Jan Hubicka + + PR middle-end/28779 + * ipa-inline.c (cgraph_decide_inlining, cgraph_early_inlining): Compute + function body sizes. + * cgraphunit.c (cgraph_analyze_function): Don't do so. + +2006-08-20 Danny Smith PR target/28648 c: * tree.c (handle_dll_attribute): Return early if not a diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 64b3891df7b..00351d25779 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -928,7 +928,8 @@ cgraph_analyze_function (struct cgraph_node *node) cgraph_create_edges (node, decl); node->local.inlinable = tree_inlinable_function_p (decl); - node->local.self_insns = estimate_num_insns (decl); + if (!flag_unit_at_a_time) + node->local.self_insns = estimate_num_insns (decl); if (node->local.inlinable) node->local.disregard_inline_limits = lang_hooks.tree_inlining.disregard_inline_limits (decl); diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 6bbfcf0c00e..cc83d366a56 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -899,13 +899,23 @@ cgraph_decide_inlining (void) timevar_push (TV_INLINE_HEURISTICS); max_count = 0; for (node = cgraph_nodes; node; node = node->next) - { - struct cgraph_edge *e; - initial_insns += node->local.self_insns; - for (e = node->callees; e; e = e->next_callee) - if (max_count < e->count) - max_count = e->count; - } + if (node->analyzed && (node->needed || node->reachable)) + { + struct cgraph_edge *e; + + /* At the moment, no IPA passes change function bodies before inlining. + Save some time by not recomputing function body sizes if early inlining + already did so. */ + if (!flag_early_inlining) + node->local.self_insns = node->global.insns + = estimate_num_insns (node->decl); + + initial_insns += node->local.self_insns; + gcc_assert (node->local.self_insns == node->global.insns); + for (e = node->callees; e; e = e->next_callee) + if (max_count < e->count) + max_count = e->count; + } overall_insns = initial_insns; gcc_assert (!max_count || (profile_info && flag_branch_probabilities)); @@ -1177,6 +1187,13 @@ cgraph_early_inlining (void) order = ggc_alloc (sizeof (*order) * cgraph_n_nodes); nnodes = cgraph_postorder (order); + for (i = nnodes - 1; i >= 0; i--) + { + node = order[i]; + if (node->analyzed && (node->needed || node->reachable)) + node->local.self_insns = node->global.insns + = estimate_num_insns (node->decl); + } for (i = nnodes - 1; i >= 0; i--) { node = order[i]; -- cgit v1.2.3