aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-inline-analysis.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2020-10-02 18:41:34 +0200
committerMartin Jambor <mjambor@suse.cz>2020-10-02 18:41:34 +0200
commit9d5af1db2d1e7ca4f47f16fc885e1d70fa0229fc (patch)
treeb3bf0625431eeee99ab6d73db07caec903d4b266 /gcc/ipa-inline-analysis.c
parent080a23bce12fa3f25860631f019777f728d2ef11 (diff)
downloadgcc-9d5af1db2d1e7ca4f47f16fc885e1d70fa0229fc.zip
gcc-9d5af1db2d1e7ca4f47f16fc885e1d70fa0229fc.tar.gz
gcc-9d5af1db2d1e7ca4f47f16fc885e1d70fa0229fc.tar.bz2
ipa: Bundle vectors describing argument values
Hi, this large patch is mostly mechanical change which aims to replace uses of separate vectors about known scalar values (usually called known_vals or known_csts), known aggregate values (known_aggs), known virtual call contexts (known_contexts) and known value ranges (known_value_ranges) with uses of either new type ipa_call_arg_values or ipa_auto_call_arg_values, both of which simply contain these vectors inside them. The need for two distinct comes from the fact that when the vectors are constructed from jump functions or lattices, we really should use auto_vecs with embedded storage allocated on stack. On the other hand, the bundle in ipa_call_context can be allocated on heap when in cache, one time for each call_graph node. ipa_call_context is constructible from ipa_auto_call_arg_values but then its vectors must not be resized, otherwise the vectors will stop pointing to the stack ones. Unfortunately, I don't think the structure embedded in ipa_call_context can be made constant because we need to manipulate and deallocate it when in cache. gcc/ChangeLog: 2020-09-01 Martin Jambor <mjambor@suse.cz> * ipa-prop.h (ipa_auto_call_arg_values): New type. (class ipa_call_arg_values): Likewise. (ipa_get_indirect_edge_target): Replaced vector arguments with ipa_call_arg_values in declaration. Added an overload for ipa_auto_call_arg_values. * ipa-fnsummary.h (ipa_call_context): Removed members m_known_vals, m_known_contexts, m_known_aggs, duplicate_from, release and equal_to, new members m_avals, store_to_cache and equivalent_to_p. Adjusted construcotr arguments. (estimate_ipcp_clone_size_and_time): Replaced vector arguments with ipa_auto_call_arg_values in declaration. (evaluate_properties_for_edge): Likewise. * ipa-cp.c (ipa_get_indirect_edge_target): Adjusted to work on ipa_call_arg_values rather than on separate vectors. Added an overload for ipa_auto_call_arg_values. (devirtualization_time_bonus): Adjusted to work on ipa_auto_call_arg_values rather than on separate vectors. (gather_context_independent_values): Adjusted to work on ipa_auto_call_arg_values rather than on separate vectors. (perform_estimation_of_a_value): Likewise. (estimate_local_effects): Likewise. (modify_known_vectors_with_val): Adjusted both variants to work on ipa_auto_call_arg_values and rename them to copy_known_vectors_add_val. (decide_about_value): Adjusted to work on ipa_call_arg_values rather than on separate vectors. (decide_whether_version_node): Likewise. * ipa-fnsummary.c (evaluate_conditions_for_known_args): Likewise. (evaluate_properties_for_edge): Likewise. (ipa_fn_summary_t::duplicate): Likewise. (estimate_edge_devirt_benefit): Adjusted to work on ipa_call_arg_values rather than on separate vectors. (estimate_edge_size_and_time): Likewise. (estimate_calls_size_and_time_1): Likewise. (summarize_calls_size_and_time): Adjusted calls to estimate_edge_size_and_time. (estimate_calls_size_and_time): Adjusted to work on ipa_call_arg_values rather than on separate vectors. (ipa_call_context::ipa_call_context): Construct from a pointer to ipa_auto_call_arg_values instead of inividual vectors. (ipa_call_context::duplicate_from): Adjusted to access vectors within m_avals. (ipa_call_context::release): Likewise. (ipa_call_context::equal_to): Likewise. (ipa_call_context::estimate_size_and_time): Adjusted to work on ipa_call_arg_values rather than on separate vectors. (estimate_ipcp_clone_size_and_time): Adjusted to work with ipa_auto_call_arg_values rather than on separate vectors. (ipa_merge_fn_summary_after_inlining): Likewise. Adjusted call to estimate_edge_size_and_time. (ipa_update_overall_fn_summary): Adjusted call to estimate_edge_size_and_time. * ipa-inline-analysis.c (do_estimate_edge_time): Adjusted to work with ipa_auto_call_arg_values rather than with separate vectors. (do_estimate_edge_size): Likewise. (do_estimate_edge_hints): Likewise. * ipa-prop.c (ipa_auto_call_arg_values::~ipa_auto_call_arg_values): New destructor.
Diffstat (limited to 'gcc/ipa-inline-analysis.c')
-rw-r--r--gcc/ipa-inline-analysis.c41
1 files changed, 12 insertions, 29 deletions
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index 148efbc..d2ae819 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -184,20 +184,16 @@ do_estimate_edge_time (struct cgraph_edge *edge, sreal *ret_nonspec_time)
ipa_hints hints;
struct cgraph_node *callee;
clause_t clause, nonspec_clause;
- auto_vec<tree, 32> known_vals;
- auto_vec<ipa_polymorphic_call_context, 32> known_contexts;
- auto_vec<ipa_agg_value_set, 32> known_aggs;
+ ipa_auto_call_arg_values avals;
class ipa_call_summary *es = ipa_call_summaries->get (edge);
int min_size = -1;
callee = edge->callee->ultimate_alias_target ();
gcc_checking_assert (edge->inline_failed);
- evaluate_properties_for_edge (edge, true,
- &clause, &nonspec_clause, &known_vals,
- &known_contexts, &known_aggs);
- ipa_call_context ctx (callee, clause, nonspec_clause, known_vals,
- known_contexts, known_aggs, es->param);
+ evaluate_properties_for_edge (edge, true, &clause, &nonspec_clause,
+ &avals, true);
+ ipa_call_context ctx (callee, clause, nonspec_clause, es->param, &avals);
if (node_context_cache != NULL)
{
node_context_summary *e = node_context_cache->get_create (callee);
@@ -255,7 +251,6 @@ do_estimate_edge_time (struct cgraph_edge *edge, sreal *ret_nonspec_time)
: edge->caller->count.ipa ())))
hints |= INLINE_HINT_known_hot;
- ctx.release ();
gcc_checking_assert (size >= 0);
gcc_checking_assert (time >= 0);
@@ -307,9 +302,6 @@ do_estimate_edge_size (struct cgraph_edge *edge)
int size;
struct cgraph_node *callee;
clause_t clause, nonspec_clause;
- auto_vec<tree, 32> known_vals;
- auto_vec<ipa_polymorphic_call_context, 32> known_contexts;
- auto_vec<ipa_agg_value_set, 32> known_aggs;
/* When we do caching, use do_estimate_edge_time to populate the entry. */
@@ -325,14 +317,11 @@ do_estimate_edge_size (struct cgraph_edge *edge)
/* Early inliner runs without caching, go ahead and do the dirty work. */
gcc_checking_assert (edge->inline_failed);
- evaluate_properties_for_edge (edge, true,
- &clause, &nonspec_clause,
- &known_vals, &known_contexts,
- &known_aggs);
- ipa_call_context ctx (callee, clause, nonspec_clause, known_vals,
- known_contexts, known_aggs, vNULL);
+ ipa_auto_call_arg_values avals;
+ evaluate_properties_for_edge (edge, true, &clause, &nonspec_clause,
+ &avals, true);
+ ipa_call_context ctx (callee, clause, nonspec_clause, vNULL, &avals);
ctx.estimate_size_and_time (&size, NULL, NULL, NULL, NULL);
- ctx.release ();
return size;
}
@@ -346,9 +335,6 @@ do_estimate_edge_hints (struct cgraph_edge *edge)
ipa_hints hints;
struct cgraph_node *callee;
clause_t clause, nonspec_clause;
- auto_vec<tree, 32> known_vals;
- auto_vec<ipa_polymorphic_call_context, 32> known_contexts;
- auto_vec<ipa_agg_value_set, 32> known_aggs;
/* When we do caching, use do_estimate_edge_time to populate the entry. */
@@ -364,14 +350,11 @@ do_estimate_edge_hints (struct cgraph_edge *edge)
/* Early inliner runs without caching, go ahead and do the dirty work. */
gcc_checking_assert (edge->inline_failed);
- evaluate_properties_for_edge (edge, true,
- &clause, &nonspec_clause,
- &known_vals, &known_contexts,
- &known_aggs);
- ipa_call_context ctx (callee, clause, nonspec_clause, known_vals,
- known_contexts, known_aggs, vNULL);
+ ipa_auto_call_arg_values avals;
+ evaluate_properties_for_edge (edge, true, &clause, &nonspec_clause,
+ &avals, true);
+ ipa_call_context ctx (callee, clause, nonspec_clause, vNULL, &avals);
ctx.estimate_size_and_time (NULL, NULL, NULL, NULL, &hints);
- ctx.release ();
hints |= simple_edge_hints (edge);
return hints;
}