Commit 263e19c7 by Jan Hubicka Committed by Jan Hubicka

ipa-inline-analysis.c (cgraph_2edge_hook_list, [...]): Remove.

	* ipa-inline-analysis.c (cgraph_2edge_hook_list, cgraph_edge_hook_list,
	inline_edge_removal_hook, inline_edge_duplication_hook): Remove.
	(inline_edge_summary_vec): Turn into ...
	(ipa_call_summaries): ... this one.
	(redirect_to_unreachable, edge_set_predicate,
	evaluate_properties_for_edge, inline_summary_alloc,
	reset_ipa_call_summary, reset_inline_summary,
	inline_summary_t::duplicate): Update.
	(inline_edge_duplication_hook): Turn to ...
	(ipa_call_summary_t::duplicate): ... this one.
	(inline_edge_removal_hook): Turn to ...
	(ipa_call_summary_t::remove): ... this one.
	(dump_inline_edge_summary): Turn to ...
	(dump_ipa_call_summary): ... this one.
	(estimate_function_body_sizes): Update.
	(inline_update_callee_summaries): Update.
	(remap_edge_change_prob): Update.
	(remap_edge_summaries): Update.
	(inline_merge_summary): Update.
	(do_estimate_edge_time): Update.
	(inline_generate_summary): Update.
	(inline_read_section): Update.
	(inline_read_summary): Update.
	(inline_free_summary): Update.
	* ipa-inline.c (can_inline_edge_p): Update.
	(compute_inlined_call_time): Update.
	(want_inline_small_function_p): Update.
	(edge_badness): Update.
	(early_inliner): Update.
	* ipa-inline.h (inline_edge_summary): Turn to ...
	(ipa_call_summary): ... this one.
	(ipa_call_summary_t): New class.
	(inline_edge_summary_t, inline_edge_summary_vec): Remove.
	(ipa_call_summaries): New.
	(inline_edge_summary): Remove.
	(estimate_edge_growth): Update.
	* ipa-profile.c (ipa_propagate_frequency_1): Update.
	* ipa-prop.c (ipa_make_edge_direct_to_target): Update.
	* ipa-split.c (execute_split_functions): Update.
	* ipa.c (symbol_table::remove_unreachable_nodes): Update.

From-SVN: r248262
parent 035ab826
2017-05-19 Jan Hubicka <hubicka@ucw.cz>
* ipa-inline-analysis.c (cgraph_2edge_hook_list, cgraph_edge_hook_list,
inline_edge_removal_hook, inline_edge_duplication_hook): Remove.
(inline_edge_summary_vec): Turn into ...
(ipa_call_summaries): ... this one.
(redirect_to_unreachable, edge_set_predicate,
evaluate_properties_for_edge, inline_summary_alloc,
reset_ipa_call_summary, reset_inline_summary,
inline_summary_t::duplicate): Update.
(inline_edge_duplication_hook): Turn to ...
(ipa_call_summary_t::duplicate): ... this one.
(inline_edge_removal_hook): Turn to ...
(ipa_call_summary_t::remove): ... this one.
(dump_inline_edge_summary): Turn to ...
(dump_ipa_call_summary): ... this one.
(estimate_function_body_sizes): Update.
(inline_update_callee_summaries): Update.
(remap_edge_change_prob): Update.
(remap_edge_summaries): Update.
(inline_merge_summary): Update.
(do_estimate_edge_time): Update.
(inline_generate_summary): Update.
(inline_read_section): Update.
(inline_read_summary): Update.
(inline_free_summary): Update.
* ipa-inline.c (can_inline_edge_p): Update.
(compute_inlined_call_time): Update.
(want_inline_small_function_p): Update.
(edge_badness): Update.
(early_inliner): Update.
* ipa-inline.h (inline_edge_summary): Turn to ...
(ipa_call_summary): ... this one.
(ipa_call_summary_t): New class.
(inline_edge_summary_t, inline_edge_summary_vec): Remove.
(ipa_call_summaries): New.
(inline_edge_summary): Remove.
(estimate_edge_growth): Update.
* ipa-profile.c (ipa_propagate_frequency_1): Update.
* ipa-prop.c (ipa_make_edge_direct_to_target): Update.
* ipa-split.c (execute_split_functions): Update.
* ipa.c (symbol_table::remove_unreachable_nodes): Update.
2017-05-19 Richard Biener <rguenther@suse.de>
PR middle-end/80764
......
......@@ -493,7 +493,7 @@ can_inline_edge_p (struct cgraph_edge *e, bool report,
> opt_for_fn (caller->decl, optimize)))
{
if (estimate_edge_time (e)
>= 20 + inline_edge_summary (e)->call_stmt_time)
>= 20 + ipa_call_summaries->get (e)->call_stmt_time)
{
e->inline_failed = CIF_OPTIMIZATION_MISMATCH;
inlinable = false;
......@@ -672,7 +672,7 @@ compute_inlined_call_time (struct cgraph_edge *edge,
/* This calculation should match one in ipa-inline-analysis.c
(estimate_edge_size_and_time). */
time -= (sreal) edge->frequency
* inline_edge_summary (edge)->call_stmt_time / CGRAPH_FREQ_BASE;
* ipa_call_summaries->get (edge)->call_stmt_time / CGRAPH_FREQ_BASE;
time += caller_time;
if (time <= 0)
time = ((sreal) 1) >> 8;
......@@ -722,16 +722,16 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
else if ((!DECL_DECLARED_INLINE_P (callee->decl)
&& (!e->count || !e->maybe_hot_p ()))
&& inline_summaries->get (callee)->min_size
- inline_edge_summary (e)->call_stmt_size
> MAX (MAX_INLINE_INSNS_SINGLE, MAX_INLINE_INSNS_AUTO))
- ipa_call_summaries->get (e)->call_stmt_size
> (unsigned)MAX (MAX_INLINE_INSNS_SINGLE, MAX_INLINE_INSNS_AUTO))
{
e->inline_failed = CIF_MAX_INLINE_INSNS_AUTO_LIMIT;
want_inline = false;
}
else if ((DECL_DECLARED_INLINE_P (callee->decl) || e->count)
&& inline_summaries->get (callee)->min_size
- inline_edge_summary (e)->call_stmt_size
> 16 * MAX_INLINE_INSNS_SINGLE)
- ipa_call_summaries->get (e)->call_stmt_size
> (unsigned)16 * MAX_INLINE_INSNS_SINGLE)
{
e->inline_failed = (DECL_DECLARED_INLINE_P (callee->decl)
? CIF_MAX_INLINE_INSNS_SINGLE_LIMIT
......@@ -1172,7 +1172,7 @@ edge_badness (struct cgraph_edge *edge, bool dump)
of functions fully inlined in program. */
else
{
int nest = MIN (inline_edge_summary (edge)->loop_depth, 8);
int nest = MIN (ipa_call_summaries->get (edge)->loop_depth, 8);
badness = growth;
/* Decrease badness if call is nested. */
......@@ -2691,14 +2691,11 @@ early_inliner (function *fun)
statements that don't have inline parameters computed. */
for (edge = node->callees; edge; edge = edge->next_callee)
{
if (inline_edge_summary_vec.length () > (unsigned) edge->uid)
{
struct inline_edge_summary *es = inline_edge_summary (edge);
es->call_stmt_size
= estimate_num_insns (edge->call_stmt, &eni_size_weights);
es->call_stmt_time
= estimate_num_insns (edge->call_stmt, &eni_time_weights);
}
struct ipa_call_summary *es = ipa_call_summaries->get (edge);
es->call_stmt_size
= estimate_num_insns (edge->call_stmt, &eni_size_weights);
es->call_stmt_time
= estimate_num_insns (edge->call_stmt, &eni_time_weights);
}
inline_update_overall_summary (node);
inlined = false;
......@@ -2719,14 +2716,12 @@ early_inliner (function *fun)
for (edge = node->callees; edge; edge = edge->next_callee)
{
/* We have no summary for new bound store calls yet. */
if (inline_edge_summary_vec.length () > (unsigned)edge->uid)
{
struct inline_edge_summary *es = inline_edge_summary (edge);
es->call_stmt_size
= estimate_num_insns (edge->call_stmt, &eni_size_weights);
es->call_stmt_time
= estimate_num_insns (edge->call_stmt, &eni_time_weights);
}
struct ipa_call_summary *es = ipa_call_summaries->get (edge);
es->call_stmt_size
= estimate_num_insns (edge->call_stmt, &eni_size_weights);
es->call_stmt_time
= estimate_num_insns (edge->call_stmt, &eni_time_weights);
if (edge->callee->decl
&& !gimple_check_call_matching_types (
edge->call_stmt, edge->callee->decl, false))
......
......@@ -183,24 +183,33 @@ public:
extern GTY(()) function_summary <inline_summary *> *inline_summaries;
/* Information kept about callgraph edges. */
struct inline_edge_summary
struct ipa_call_summary
{
/* Estimated size and time of the call statement. */
int call_stmt_size;
int call_stmt_time;
/* Depth of loop nest, 0 means no nesting. */
unsigned short int loop_depth;
class predicate *predicate;
/* Array indexed by parameters.
0 means that parameter change all the time, REG_BR_PROB_BASE means
that parameter is constant. */
/* Vector indexed by parameters. */
vec<inline_param_summary> param;
/* Estimated size and time of the call statement. */
unsigned int call_stmt_size;
unsigned int call_stmt_time;
/* Depth of loop nest, 0 means no nesting. */
unsigned int loop_depth;
};
/* Need a typedef for inline_edge_summary because of inline function
'inline_edge_summary' below. */
typedef struct inline_edge_summary inline_edge_summary_t;
extern vec<inline_edge_summary_t> inline_edge_summary_vec;
class ipa_call_summary_t: public call_summary <ipa_call_summary *>
{
public:
ipa_call_summary_t (symbol_table *symtab, bool ggc):
call_summary <ipa_call_summary *> (symtab, ggc) {}
/* Hook that is called by summary when an edge is duplicated. */
virtual void remove (cgraph_edge *cs, ipa_call_summary *);
/* Hook that is called by summary when an edge is duplicated. */
virtual void duplicate (cgraph_edge *src, cgraph_edge *dst,
ipa_call_summary *src_data,
ipa_call_summary *dst_data);
};
extern call_summary <ipa_call_summary *> *ipa_call_summaries;
/* Data we cache about callgraph edges during inlining to avoid expensive
re-computations during the greedy algorithm. */
......@@ -256,12 +265,6 @@ void clone_inlined_nodes (struct cgraph_edge *e, bool, bool, int *,
extern int ncalls_inlined;
extern int nfunctions_inlined;
static inline struct inline_edge_summary *
inline_edge_summary (struct cgraph_edge *edge)
{
return &inline_edge_summary_vec[edge->uid];
}
/* Return estimated size of the inline sequence of EDGE. */
......@@ -280,10 +283,10 @@ estimate_edge_size (struct cgraph_edge *edge)
static inline int
estimate_edge_growth (struct cgraph_edge *edge)
{
gcc_checking_assert (inline_edge_summary (edge)->call_stmt_size
gcc_checking_assert (ipa_call_summaries->get (edge)->call_stmt_size
|| !edge->callee->analyzed);
return (estimate_edge_size (edge)
- inline_edge_summary (edge)->call_stmt_size);
- ipa_call_summaries->get (edge)->call_stmt_size);
}
/* Return estimated callee runtime increase after inlining
......
......@@ -348,7 +348,7 @@ ipa_propagate_frequency_1 (struct cgraph_node *node, void *data)
fprintf (dump_file, " Called by %s that is executed once\n",
edge->caller->name ());
d->maybe_unlikely_executed = false;
if (inline_edge_summary (edge)->loop_depth)
if (ipa_call_summaries->get (edge)->loop_depth)
{
d->maybe_executed_once = false;
if (dump_file && (dump_flags & TDF_DETAILS))
......
......@@ -2828,7 +2828,7 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target,
bool speculative)
{
struct cgraph_node *callee;
struct inline_edge_summary *es = inline_edge_summary (ie);
struct ipa_call_summary *es = ipa_call_summaries->get (ie);
bool unreachable = false;
if (TREE_CODE (target) == ADDR_EXPR)
......@@ -2977,7 +2977,7 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target,
for direct call (adjusted by inline_edge_duplication_hook). */
if (ie == orig)
{
es = inline_edge_summary (ie);
es = ipa_call_summaries->get (ie);
es->call_stmt_size -= (eni_size_weights.indirect_call_cost
- eni_size_weights.call_cost);
es->call_stmt_time -= (eni_time_weights.indirect_call_cost
......
......@@ -1742,7 +1742,7 @@ execute_split_functions (void)
}
/* This can be relaxed; function might become inlinable after splitting
away the uninlinable part. */
if (inline_edge_summary_vec.exists ()
if (inline_summaries
&& !inline_summaries->get (node)->inlinable)
{
if (dump_file)
......
......@@ -698,7 +698,7 @@ symbol_table::remove_unreachable_nodes (FILE *file)
symtab_node::checking_verify_symtab_nodes ();
/* If we removed something, perhaps profile could be improved. */
if (changed && optimize && inline_edge_summary_vec.exists ())
if (changed && optimize && ipa_call_summaries)
FOR_EACH_DEFINED_FUNCTION (node)
ipa_propagate_frequency (node);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment