From 411a20d66cc3d87283a0caebbe1400ac2258aea5 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Sat, 14 May 2011 00:01:59 +0200 Subject: ipa-prop.c (ipa_cst_from_jfunc): New function. 2011-05-13 Martin Jambor * ipa-prop.c (ipa_cst_from_jfunc): New function. * ipa-prop.h (ipa_cst_from_jfunc): Declare. * ipa-inline-analysis.c (evaluate_conditions_for_edge): Use it. (evaluate_conditions_for_ipcp_clone): Removed. (estimate_ipcp_clone_size_and_time): Accept vector of known constants. * ipa-cp.c (ipcp_estimate_growth): Build vector of known constants. * ipa-inline.h (estimate_ipcp_clone_size_and_time): Update. From-SVN: r173739 --- gcc/ipa-cp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gcc/ipa-cp.c') diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 41046d1..18bfe90 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -1068,6 +1068,7 @@ ipcp_estimate_growth (struct cgraph_node *node) int removable_args = 0; bool need_original = !cgraph_will_be_removed_from_program_if_no_direct_calls (node); + VEC (tree, heap) *known_vals = NULL; struct ipa_node_params *info; int i, count; int growth; @@ -1085,6 +1086,7 @@ ipcp_estimate_growth (struct cgraph_node *node) info = IPA_NODE_REF (node); count = ipa_get_param_count (info); + VEC_safe_grow_cleared (tree, heap, known_vals, count); if (node->local.can_change_signature) for (i = 0; i < count; i++) { @@ -1095,14 +1097,18 @@ ipcp_estimate_growth (struct cgraph_node *node) removable_args++; if (lat->type == IPA_CONST_VALUE) - removable_args++; + { + removable_args++; + VEC_replace (tree, known_vals, i, lat->constant); + } } /* We make just very simple estimate of savings for removal of operand from call site. Precise cost is difficult to get, as our size metric counts constants and moves as free. Generally we are looking for cases that small function is called very many times. */ - estimate_ipcp_clone_size_and_time (node, &growth, NULL); + estimate_ipcp_clone_size_and_time (node, known_vals, &growth, NULL); + VEC_free (tree, heap, known_vals); growth = growth - removable_args * redirectable_node_callers; if (growth < 0) -- cgit v1.1