Commit 0f378cb5 by Jan Hubicka Committed by Jan Hubicka

ipa-cp.c (ipcp_discover_new_direct_edges): If something was turned to direct…

ipa-cp.c (ipcp_discover_new_direct_edges): If something was turned to direct call update the summary.


	* ipa-cp.c (ipcp_discover_new_direct_edges): If something was turned
	to direct call update the summary.
	* ipa-inline-transform.c (inline_call): Sanity check that summaries
	match the predicted effect; fix updating of summary after edge
	redirection.
	* ipa-inline-analysis.c (inline_node_duplication_hook): Do not try
	to update the summary and recompute it instead.
	(estimate_function_body_sizes): Fix self size estimation; double
	check that it agrees with inline_update_overall_summary.
	(estimate_edge_size_and_time): Handle devirtualizaiton costs.
	(estimate_edge_devirt_benefit): Update to be called from
	estimate_edge_size_and_time.
	(estimate_calls_size_and_time): Update.
	(estimate_node_size_and_time): Watch overflows.
	(inline_merge_summary): Likewise.
	* ipa-prob.c: Include ipa-inline.h
	(ipa_make_edge_direct_to_target): After redirection update the summary.

From-SVN: r192821
parent 0d198936
2012-10-25 Jan Hubicka <jh@suse.cz>
* ipa-cp.c (ipcp_discover_new_direct_edges): If something was turned
to direct call update the summary.
* ipa-inline-transform.c (inline_call): Sanity check that summaries
match the predicted effect; fix updating of summary after edge
redirection.
* ipa-inline-analysis.c (inline_node_duplication_hook): Do not try
to update the summary and recompute it instead.
(estimate_function_body_sizes): Fix self size estimation; double
check that it agrees with inline_update_overall_summary.
(estimate_edge_size_and_time): Handle devirtualizaiton costs.
(estimate_edge_devirt_benefit): Update to be called from
estimate_edge_size_and_time.
(estimate_calls_size_and_time): Update.
(estimate_node_size_and_time): Watch overflows.
(inline_merge_summary): Likewise.
* ipa-prob.c: Include ipa-inline.h
(ipa_make_edge_direct_to_target): After redirection update the summary.
2012-10-25 Cary Coutant <ccoutant@google.com>
PR debug/55063
......@@ -1688,6 +1688,7 @@ ipcp_discover_new_direct_edges (struct cgraph_node *node,
VEC (tree, heap) *known_vals)
{
struct cgraph_edge *ie, *next_ie;
bool found = false;
for (ie = node->indirect_calls; ie; ie = next_ie)
{
......@@ -1696,8 +1697,14 @@ ipcp_discover_new_direct_edges (struct cgraph_node *node,
next_ie = ie->next_callee;
target = ipa_get_indirect_edge_target (ie, known_vals, NULL, NULL);
if (target)
ipa_make_edge_direct_to_target (ie, target);
{
ipa_make_edge_direct_to_target (ie, target);
found = true;
}
}
/* Turning calls to direct calls will improve overall summary. */
if (found)
inline_update_overall_summary (node);
}
/* Vector of pointers which for linked lists of clones of an original crgaph
......
......@@ -209,6 +209,12 @@ inline_call (struct cgraph_edge *e, bool update_original,
struct cgraph_node *to = NULL;
struct cgraph_edge *curr = e;
struct cgraph_node *callee = cgraph_function_or_thunk_node (e->callee, NULL);
bool new_edges_found = false;
#ifdef ENABLE_CHECKING
int estimated_growth = estimate_edge_growth (e);
bool predicated = inline_edge_summary (e)->predicate != NULL;
#endif
/* Don't inline inlined edges. */
gcc_assert (e->inline_failed);
......@@ -248,19 +254,28 @@ inline_call (struct cgraph_edge *e, bool update_original,
old_size = inline_summary (to)->size;
inline_merge_summary (e);
if (optimize)
new_edges_found = ipa_propagate_indirect_call_infos (curr, new_edges);
if (update_overall_summary)
inline_update_overall_summary (to);
new_size = inline_summary (to)->size;
#ifdef ENABLE_CHECKING
/* Verify that estimated growth match real growth. Allow off-by-one
error due to INLINE_SIZE_SCALE roudoff errors. */
gcc_assert (!update_overall_summary || !overall_size
|| abs (estimated_growth - (new_size - old_size)) <= 1
/* FIXME: a hack. Edges with false predicate are accounted
wrong, we should remove them from callgraph. */
|| predicated);
#endif
if (overall_size)
*overall_size += new_size - old_size;
ncalls_inlined++;
/* This must happen after inline_merge_summary that rely on jump
functions of callee to not be updated. */
if (optimize)
return ipa_propagate_indirect_call_infos (curr, new_edges);
else
return false;
return new_edges_found;
}
......
......@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-flow.h"
#include "tree-pass.h"
#include "tree-inline.h"
#include "ipa-inline.h"
#include "gimple.h"
#include "flags.h"
#include "diagnostic.h"
......@@ -2100,6 +2101,7 @@ struct cgraph_edge *
ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target)
{
struct cgraph_node *callee;
struct inline_edge_summary *es = inline_edge_summary (ie);
if (TREE_CODE (target) == ADDR_EXPR)
target = TREE_OPERAND (target, 0);
......@@ -2115,6 +2117,11 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target)
gcc_assert (!callee->global.inlined_to);
cgraph_make_edge_direct (ie, callee);
es = inline_edge_summary (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
- eni_time_weights.call_cost);
if (dump_file)
{
fprintf (dump_file, "ipa-prop: Discovered %s call to a known target "
......
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