Commit 0d92b555 by Jan Hubicka Committed by Jan Hubicka

re PR ipa/64481 (r219076 breaks bootstrap (x86_64-unknown-linux-gnu))


	PR ipa/64481
	* ipa-inline-analysis.c (node_growth_cache): Remove.
	(initialize_growth_caches): Do not initialize it.
	(free_growth_caches): Do not free it.
	(do_estimate_growth): Rename to ...
	(estimate_growth): ... this one; drop growth cache code.
	(growth_likely_positive): Always go the heuristics way.
	* ipa-inline.c (can_inline_edge_p): Walk through aliases.
	(reset_edge_caches): Do not reset node growth.
	(heap_edge_removal_hook): Do not maintain cache.
	(inline_small_functions): Likewise; strenghten sanity check.
	(ipa_inline): Do not maintain caches.
	* ipa-inline.h (node_growth_cache): Remove.
	(do_estimate_growth): Remove to ...
	(estimate_growth): this one; remove inline version.
	(reset_node_growth_cache): Remove.

From-SVN: r219572
parent dc396715
2015-01-13 Jan Hubicka <hubicka@ucw.cz> 2015-01-13 Jan Hubicka <hubicka@ucw.cz>
PR ipa/64481
* ipa-inline-analysis.c (node_growth_cache): Remove.
(initialize_growth_caches): Do not initialize it.
(free_growth_caches): Do not free it.
(do_estimate_growth): Rename to ...
(estimate_growth): ... this one; drop growth cache code.
(growth_likely_positive): Always go the heuristics way.
* ipa-inline.c (can_inline_edge_p): Walk through aliases.
(reset_edge_caches): Do not reset node growth.
(heap_edge_removal_hook): Do not maintain cache.
(inline_small_functions): Likewise; strenghten sanity check.
(ipa_inline): Do not maintain caches.
* ipa-inline.h (node_growth_cache): Remove.
(do_estimate_growth): Remove to ...
(estimate_growth): this one; remove inline version.
(reset_node_growth_cache): Remove.
2015-01-13 Jan Hubicka <hubicka@ucw.cz>
PR ipa/64565 PR ipa/64565
* ipa-inline.c (inline_small_functions): Update callee keys after * ipa-inline.c (inline_small_functions): Update callee keys after
resolving speculation resolving speculation
......
...@@ -167,7 +167,6 @@ function_summary <inline_summary *> *inline_summaries; ...@@ -167,7 +167,6 @@ function_summary <inline_summary *> *inline_summaries;
vec<inline_edge_summary_t> inline_edge_summary_vec; vec<inline_edge_summary_t> inline_edge_summary_vec;
/* Cached node/edge growths. */ /* Cached node/edge growths. */
vec<int> node_growth_cache;
vec<edge_growth_cache_entry> edge_growth_cache; vec<edge_growth_cache_entry> edge_growth_cache;
/* Edge predicates goes here. */ /* Edge predicates goes here. */
...@@ -1341,8 +1340,6 @@ initialize_growth_caches (void) ...@@ -1341,8 +1340,6 @@ initialize_growth_caches (void)
{ {
if (symtab->edges_max_uid) if (symtab->edges_max_uid)
edge_growth_cache.safe_grow_cleared (symtab->edges_max_uid); edge_growth_cache.safe_grow_cleared (symtab->edges_max_uid);
if (symtab->cgraph_max_uid)
node_growth_cache.safe_grow_cleared (symtab->cgraph_max_uid);
} }
...@@ -1352,7 +1349,6 @@ void ...@@ -1352,7 +1349,6 @@ void
free_growth_caches (void) free_growth_caches (void)
{ {
edge_growth_cache.release (); edge_growth_cache.release ();
node_growth_cache.release ();
} }
...@@ -3931,7 +3927,7 @@ do_estimate_growth_1 (struct cgraph_node *node, void *data) ...@@ -3931,7 +3927,7 @@ do_estimate_growth_1 (struct cgraph_node *node, void *data)
/* Estimate the growth caused by inlining NODE into all callees. */ /* Estimate the growth caused by inlining NODE into all callees. */
int int
do_estimate_growth (struct cgraph_node *node) estimate_growth (struct cgraph_node *node)
{ {
struct growth_data d = { node, 0, false }; struct growth_data d = { node, 0, false };
struct inline_summary *info = inline_summaries->get (node); struct inline_summary *info = inline_summaries->get (node);
...@@ -3960,12 +3956,6 @@ do_estimate_growth (struct cgraph_node *node) ...@@ -3960,12 +3956,6 @@ do_estimate_growth (struct cgraph_node *node)
+ 50) / 100; + 50) / 100;
} }
if (node_growth_cache.exists ())
{
if ((int) node_growth_cache.length () <= node->uid)
node_growth_cache.safe_grow_cleared (symtab->cgraph_max_uid);
node_growth_cache[node->uid] = d.growth + (d.growth >= 0);
}
return d.growth; return d.growth;
} }
...@@ -3979,7 +3969,6 @@ bool ...@@ -3979,7 +3969,6 @@ bool
growth_likely_positive (struct cgraph_node *node, int edge_growth ATTRIBUTE_UNUSED) growth_likely_positive (struct cgraph_node *node, int edge_growth ATTRIBUTE_UNUSED)
{ {
int max_callers; int max_callers;
int ret;
struct cgraph_edge *e; struct cgraph_edge *e;
gcc_checking_assert (edge_growth > 0); gcc_checking_assert (edge_growth > 0);
...@@ -3999,10 +3988,6 @@ growth_likely_positive (struct cgraph_node *node, int edge_growth ATTRIBUTE_UNUS ...@@ -3999,10 +3988,6 @@ growth_likely_positive (struct cgraph_node *node, int edge_growth ATTRIBUTE_UNUS
|| !node->can_remove_if_no_direct_calls_p ()) || !node->can_remove_if_no_direct_calls_p ())
return true; return true;
/* If there is cached value, just go ahead. */
if ((int)node_growth_cache.length () > node->uid
&& (ret = node_growth_cache[node->uid]))
return ret > 0;
if (!node->will_be_removed_from_program_if_no_direct_calls_p () if (!node->will_be_removed_from_program_if_no_direct_calls_p ()
&& (!DECL_COMDAT (node->decl) && (!DECL_COMDAT (node->decl)
|| !node->can_remove_if_no_direct_calls_p ())) || !node->can_remove_if_no_direct_calls_p ()))
......
...@@ -388,11 +388,11 @@ can_inline_edge_p (struct cgraph_edge *e, bool report, ...@@ -388,11 +388,11 @@ can_inline_edge_p (struct cgraph_edge *e, bool report,
else if (caller_tree != callee_tree) else if (caller_tree != callee_tree)
{ {
if (((opt_for_fn (e->caller->decl, optimize) if (((opt_for_fn (e->caller->decl, optimize)
> opt_for_fn (e->callee->decl, optimize)) > opt_for_fn (callee->decl, optimize))
|| (opt_for_fn (e->caller->decl, optimize_size) || (opt_for_fn (e->caller->decl, optimize_size)
!= opt_for_fn (e->callee->decl, optimize_size))) != opt_for_fn (callee->decl, optimize_size)))
/* gcc.dg/pr43564.c. Look at forced inline even in -O0. */ /* gcc.dg/pr43564.c. Look at forced inline even in -O0. */
&& !DECL_DISREGARD_INLINE_LIMITS (e->callee->decl)) && !DECL_DISREGARD_INLINE_LIMITS (callee->decl))
{ {
e->inline_failed = CIF_OPTIMIZATION_MISMATCH; e->inline_failed = CIF_OPTIMIZATION_MISMATCH;
inlinable = false; inlinable = false;
...@@ -1095,9 +1095,6 @@ reset_edge_caches (struct cgraph_node *node) ...@@ -1095,9 +1095,6 @@ reset_edge_caches (struct cgraph_node *node)
if (where->global.inlined_to) if (where->global.inlined_to)
where = where->global.inlined_to; where = where->global.inlined_to;
/* WHERE body size has changed, the cached growth is invalid. */
reset_node_growth_cache (where);
for (edge = where->callers; edge; edge = edge->next_caller) for (edge = where->callers; edge; edge = edge->next_caller)
if (edge->inline_failed) if (edge->inline_failed)
reset_edge_growth_cache (edge); reset_edge_growth_cache (edge);
...@@ -1428,8 +1425,6 @@ add_new_edges_to_heap (edge_heap_t *heap, vec<cgraph_edge *> new_edges) ...@@ -1428,8 +1425,6 @@ add_new_edges_to_heap (edge_heap_t *heap, vec<cgraph_edge *> new_edges)
static void static void
heap_edge_removal_hook (struct cgraph_edge *e, void *data) heap_edge_removal_hook (struct cgraph_edge *e, void *data)
{ {
if (e->callee)
reset_node_growth_cache (e->callee);
if (e->aux) if (e->aux)
{ {
((edge_heap_t *)data)->delete_node ((edge_heap_node_t *)e->aux); ((edge_heap_t *)data)->delete_node ((edge_heap_node_t *)e->aux);
...@@ -1622,7 +1617,6 @@ inline_small_functions (void) ...@@ -1622,7 +1617,6 @@ inline_small_functions (void)
struct cgraph_node *where = node->global.inlined_to struct cgraph_node *where = node->global.inlined_to
? node->global.inlined_to : node; ? node->global.inlined_to : node;
inline_update_overall_summary (where); inline_update_overall_summary (where);
reset_node_growth_cache (where);
reset_edge_caches (where); reset_edge_caches (where);
update_caller_keys (&edge_heap, where, update_caller_keys (&edge_heap, where,
updated_nodes, NULL); updated_nodes, NULL);
...@@ -1653,8 +1647,15 @@ inline_small_functions (void) ...@@ -1653,8 +1647,15 @@ inline_small_functions (void)
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
/* Be sure that caches are maintained consistent. */ /* Be sure that caches are maintained consistent. */
sreal cached_badness = edge_badness (edge, false); sreal cached_badness = edge_badness (edge, false);
int old_size_est = estimate_edge_size (edge);
int old_time_est = estimate_edge_time (edge);
int old_hints_est = estimate_edge_hints (edge);
reset_edge_growth_cache (edge); reset_edge_growth_cache (edge);
reset_node_growth_cache (edge->callee); gcc_assert (old_size_est == estimate_edge_size (edge));
gcc_assert (old_time_est == estimate_edge_time (edge));
gcc_assert (old_hints_est == estimate_edge_hints (edge));
/* When updating the edge costs, we only decrease badness in the keys. /* When updating the edge costs, we only decrease badness in the keys.
Increases of badness are handled lazilly; when we see key with out Increases of badness are handled lazilly; when we see key with out
...@@ -1785,8 +1786,7 @@ inline_small_functions (void) ...@@ -1785,8 +1786,7 @@ inline_small_functions (void)
inline_call (edge, true, &new_indirect_edges, &overall_size, true); inline_call (edge, true, &new_indirect_edges, &overall_size, true);
add_new_edges_to_heap (&edge_heap, new_indirect_edges); add_new_edges_to_heap (&edge_heap, new_indirect_edges);
reset_edge_caches (edge->callee); reset_edge_caches (edge->callee->function_symbol ());
reset_node_growth_cache (callee);
update_callee_keys (&edge_heap, where, updated_nodes); update_callee_keys (&edge_heap, where, updated_nodes);
} }
...@@ -2218,7 +2218,6 @@ ipa_inline (void) ...@@ -2218,7 +2218,6 @@ ipa_inline (void)
{ {
struct cgraph_node *where = node->global.inlined_to struct cgraph_node *where = node->global.inlined_to
? node->global.inlined_to : node; ? node->global.inlined_to : node;
reset_node_growth_cache (where);
reset_edge_caches (where); reset_edge_caches (where);
inline_update_overall_summary (where); inline_update_overall_summary (where);
} }
......
...@@ -224,7 +224,6 @@ struct edge_growth_cache_entry ...@@ -224,7 +224,6 @@ struct edge_growth_cache_entry
inline_hints hints; inline_hints hints;
}; };
extern vec<int> node_growth_cache;
extern vec<edge_growth_cache_entry> edge_growth_cache; extern vec<edge_growth_cache_entry> edge_growth_cache;
/* In ipa-inline-analysis.c */ /* In ipa-inline-analysis.c */
...@@ -245,7 +244,7 @@ void estimate_ipcp_clone_size_and_time (struct cgraph_node *, ...@@ -245,7 +244,7 @@ void estimate_ipcp_clone_size_and_time (struct cgraph_node *,
vec<ipa_polymorphic_call_context>, vec<ipa_polymorphic_call_context>,
vec<ipa_agg_jump_function_p>, vec<ipa_agg_jump_function_p>,
int *, int *, inline_hints *); int *, int *, inline_hints *);
int do_estimate_growth (struct cgraph_node *); int estimate_growth (struct cgraph_node *);
bool growth_likely_positive (struct cgraph_node *, int); bool growth_likely_positive (struct cgraph_node *, int);
void inline_merge_summary (struct cgraph_edge *edge); void inline_merge_summary (struct cgraph_edge *edge);
void inline_update_overall_summary (struct cgraph_node *node); void inline_update_overall_summary (struct cgraph_node *node);
...@@ -274,21 +273,6 @@ inline_edge_summary (struct cgraph_edge *edge) ...@@ -274,21 +273,6 @@ inline_edge_summary (struct cgraph_edge *edge)
return &inline_edge_summary_vec[edge->uid]; return &inline_edge_summary_vec[edge->uid];
} }
/* Return estimated unit growth after inlning all calls to NODE.
Quick accesors to the inline growth caches.
For convenience we keep zero 0 as unknown. Because growth
can be both positive and negative, we simply increase positive
growths by 1. */
static inline int
estimate_growth (struct cgraph_node *node)
{
int ret;
if ((int)node_growth_cache.length () <= node->uid
|| !(ret = node_growth_cache[node->uid]))
return do_estimate_growth (node);
return ret - (ret > 0);
}
/* Return estimated size of the inline sequence of EDGE. */ /* Return estimated size of the inline sequence of EDGE. */
...@@ -342,16 +326,6 @@ estimate_edge_hints (struct cgraph_edge *edge) ...@@ -342,16 +326,6 @@ estimate_edge_hints (struct cgraph_edge *edge)
return ret - 1; return ret - 1;
} }
/* Reset cached value for NODE. */
static inline void
reset_node_growth_cache (struct cgraph_node *node)
{
if ((int)node_growth_cache.length () > node->uid)
node_growth_cache[node->uid] = 0;
}
/* Reset cached value for EDGE. */ /* Reset cached value for EDGE. */
static inline void static inline void
......
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