Commit 26f1a658 by Jan Hubicka Committed by Jan Hubicka

ipa-cp.c (perform_estimation_of_a_value): Drop base_time parameter; update use…

ipa-cp.c (perform_estimation_of_a_value): Drop base_time parameter; update use of estimate_ipcp_clone_size_and_time.


	* ipa-cp.c (perform_estimation_of_a_value): Drop base_time parameter;
	update use of estimate_ipcp_clone_size_and_time.
	(estimate_local_effects): Update use of
	estimate_ipcp_clone_size_and_time and perform_estimation_of_a_value.
	* ipa-inline.h (estimate_ipcp_clone_size_and_time): Update prototype.
	* ipa-inline-analysis.c (estimate_ipcp_clone_size_and_time):
	Return nonspecialized time.

	* gcc.dg/ipa/ipcp-2.c: Decrease ipcp threshold
	* gcc.dg/tree-ssa/ipa-cp-1.c: Likewise.

From-SVN: r247597
parent 4d147bca
2017-05-04 Jan Hubicka <hubicka@ucw.cz>
* ipa-cp.c (perform_estimation_of_a_value): Drop base_time parameter;
update use of estimate_ipcp_clone_size_and_time.
(estimate_local_effects): Update use of
estimate_ipcp_clone_size_and_time and perform_estimation_of_a_value.
* ipa-inline.h (estimate_ipcp_clone_size_and_time): Update prototype.
* ipa-inline-analysis.c (estimate_ipcp_clone_size_and_time):
Return nonspecialized time.
2017-05-04 Richard Biener <rguenther@suse.de> 2017-05-04 Richard Biener <rguenther@suse.de>
* tree-ssa-alias.c (get_continuation_for_phi): Improve looking * tree-ssa-alias.c (get_continuation_for_phi): Improve looking
......
...@@ -2792,16 +2792,16 @@ static void ...@@ -2792,16 +2792,16 @@ static void
perform_estimation_of_a_value (cgraph_node *node, vec<tree> known_csts, perform_estimation_of_a_value (cgraph_node *node, vec<tree> known_csts,
vec<ipa_polymorphic_call_context> known_contexts, vec<ipa_polymorphic_call_context> known_contexts,
vec<ipa_agg_jump_function_p> known_aggs_ptrs, vec<ipa_agg_jump_function_p> known_aggs_ptrs,
sreal base_time, int removable_params_cost, int removable_params_cost,
int est_move_cost, ipcp_value_base *val) int est_move_cost, ipcp_value_base *val)
{ {
int size, time_benefit; int size, time_benefit;
sreal time; sreal time, base_time;
inline_hints hints; inline_hints hints;
estimate_ipcp_clone_size_and_time (node, known_csts, known_contexts, estimate_ipcp_clone_size_and_time (node, known_csts, known_contexts,
known_aggs_ptrs, &size, &time, known_aggs_ptrs, &size, &time,
&hints); &base_time, &hints);
base_time -= time; base_time -= time;
if (base_time > 65535) if (base_time > 65535)
base_time = 65535; base_time = 65535;
...@@ -2836,15 +2836,14 @@ estimate_local_effects (struct cgraph_node *node) ...@@ -2836,15 +2836,14 @@ estimate_local_effects (struct cgraph_node *node)
vec<ipa_agg_jump_function> known_aggs; vec<ipa_agg_jump_function> known_aggs;
vec<ipa_agg_jump_function_p> known_aggs_ptrs; vec<ipa_agg_jump_function_p> known_aggs_ptrs;
bool always_const; bool always_const;
sreal base_time = inline_summaries->get (node)->time.to_int ();
int removable_params_cost; int removable_params_cost;
if (!count || !ipcp_versionable_function_p (node)) if (!count || !ipcp_versionable_function_p (node))
return; return;
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\nEstimating effects for %s/%i, base_time: %f.\n", fprintf (dump_file, "\nEstimating effects for %s/%i.\n",
node->name (), node->order, base_time.to_double ()); node->name (), node->order);
always_const = gather_context_independent_values (info, &known_csts, always_const = gather_context_independent_values (info, &known_csts,
&known_contexts, &known_aggs, &known_contexts, &known_aggs,
...@@ -2857,14 +2856,15 @@ estimate_local_effects (struct cgraph_node *node) ...@@ -2857,14 +2856,15 @@ estimate_local_effects (struct cgraph_node *node)
{ {
struct caller_statistics stats; struct caller_statistics stats;
inline_hints hints; inline_hints hints;
sreal time; sreal time, base_time;
int size; int size;
init_caller_stats (&stats); init_caller_stats (&stats);
node->call_for_symbol_thunks_and_aliases (gather_caller_stats, &stats, node->call_for_symbol_thunks_and_aliases (gather_caller_stats, &stats,
false); false);
estimate_ipcp_clone_size_and_time (node, known_csts, known_contexts, estimate_ipcp_clone_size_and_time (node, known_csts, known_contexts,
known_aggs_ptrs, &size, &time, &hints); known_aggs_ptrs, &size, &time,
&base_time, &hints);
time -= devirt_bonus; time -= devirt_bonus;
time -= hint_time_bonus (hints); time -= hint_time_bonus (hints);
time -= removable_params_cost; time -= removable_params_cost;
...@@ -2877,20 +2877,20 @@ estimate_local_effects (struct cgraph_node *node) ...@@ -2877,20 +2877,20 @@ estimate_local_effects (struct cgraph_node *node)
if (size <= 0 || node->local.local) if (size <= 0 || node->local.local)
{ {
info->do_clone_for_all_contexts = true; info->do_clone_for_all_contexts = true;
base_time = time;
if (dump_file) if (dump_file)
fprintf (dump_file, " Decided to specialize for all " fprintf (dump_file, " Decided to specialize for all "
"known contexts, code not going to grow.\n"); "known contexts, code not going to grow.\n");
} }
else if (good_cloning_opportunity_p (node, (base_time - time).to_int (), else if (good_cloning_opportunity_p (node,
MAX ((base_time - time).to_int (),
65536),
stats.freq_sum, stats.count_sum, stats.freq_sum, stats.count_sum,
size)) size))
{ {
if (size + overall_size <= max_new_size) if (size + overall_size <= max_new_size)
{ {
info->do_clone_for_all_contexts = true; info->do_clone_for_all_contexts = true;
base_time = time;
overall_size += size; overall_size += size;
if (dump_file) if (dump_file)
...@@ -2926,7 +2926,7 @@ estimate_local_effects (struct cgraph_node *node) ...@@ -2926,7 +2926,7 @@ estimate_local_effects (struct cgraph_node *node)
int emc = estimate_move_cost (TREE_TYPE (val->value), true); int emc = estimate_move_cost (TREE_TYPE (val->value), true);
perform_estimation_of_a_value (node, known_csts, known_contexts, perform_estimation_of_a_value (node, known_csts, known_contexts,
known_aggs_ptrs, base_time, known_aggs_ptrs,
removable_params_cost, emc, val); removable_params_cost, emc, val);
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
...@@ -2961,7 +2961,7 @@ estimate_local_effects (struct cgraph_node *node) ...@@ -2961,7 +2961,7 @@ estimate_local_effects (struct cgraph_node *node)
{ {
known_contexts[i] = val->value; known_contexts[i] = val->value;
perform_estimation_of_a_value (node, known_csts, known_contexts, perform_estimation_of_a_value (node, known_csts, known_contexts,
known_aggs_ptrs, base_time, known_aggs_ptrs,
removable_params_cost, 0, val); removable_params_cost, 0, val);
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
...@@ -3005,7 +3005,7 @@ estimate_local_effects (struct cgraph_node *node) ...@@ -3005,7 +3005,7 @@ estimate_local_effects (struct cgraph_node *node)
vec_safe_push (ajf->items, item); vec_safe_push (ajf->items, item);
perform_estimation_of_a_value (node, known_csts, known_contexts, perform_estimation_of_a_value (node, known_csts, known_contexts,
known_aggs_ptrs, base_time, known_aggs_ptrs,
removable_params_cost, 0, val); removable_params_cost, 0, val);
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
......
...@@ -3478,17 +3478,17 @@ estimate_ipcp_clone_size_and_time (struct cgraph_node *node, ...@@ -3478,17 +3478,17 @@ estimate_ipcp_clone_size_and_time (struct cgraph_node *node,
known_contexts, known_contexts,
vec<ipa_agg_jump_function_p> known_aggs, vec<ipa_agg_jump_function_p> known_aggs,
int *ret_size, sreal *ret_time, int *ret_size, sreal *ret_time,
sreal *ret_nonspec_time,
inline_hints *hints) inline_hints *hints)
{ {
clause_t clause, nonspec_clause; clause_t clause, nonspec_clause;
sreal nonspec_time;
evaluate_conditions_for_known_args (node, false, known_vals, known_aggs, evaluate_conditions_for_known_args (node, false, known_vals, known_aggs,
&clause, &nonspec_clause); &clause, &nonspec_clause);
estimate_node_size_and_time (node, clause, nonspec_clause, estimate_node_size_and_time (node, clause, nonspec_clause,
known_vals, known_contexts, known_vals, known_contexts,
known_aggs, ret_size, NULL, ret_time, known_aggs, ret_size, NULL, ret_time,
&nonspec_time, hints, vNULL); ret_nonspec_time, hints, vNULL);
} }
/* Translate all conditions from callee representation into caller /* Translate all conditions from callee representation into caller
......
...@@ -272,7 +272,8 @@ void estimate_ipcp_clone_size_and_time (struct cgraph_node *, ...@@ -272,7 +272,8 @@ void estimate_ipcp_clone_size_and_time (struct cgraph_node *,
vec<tree>, vec<tree>,
vec<ipa_polymorphic_call_context>, vec<ipa_polymorphic_call_context>,
vec<ipa_agg_jump_function_p>, vec<ipa_agg_jump_function_p>,
int *, sreal *, inline_hints *); int *, sreal *, sreal *,
inline_hints *);
int 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);
......
2017-05-04 Jan Hubicka <hubicka@ucw.cz>
* gcc.dg/ipa/ipcp-2.c: Decrease ipcp threshold
* gcc.dg/tree-ssa/ipa-cp-1.c: Likewise.
2017-05-04 Richard Biener <rguenther@suse.de> 2017-05-04 Richard Biener <rguenther@suse.de>
* gcc.dg/tree-ssa/ssa-fre-58.c: New testcase. * gcc.dg/tree-ssa/ssa-fre-58.c: New testcase.
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */ /* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining --param ipa-cp-eval-threshold=100" } */
/* { dg-add-options bind_pic_locally } */ /* { dg-add-options bind_pic_locally } */
extern int get_stuff (int); extern int get_stuff (int);
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O3 -fdump-tree-optimized -fno-inline" } */ /* { dg-options "-O3 -fdump-tree-optimized -fno-inline --param ipa-cp-eval-threshold=100" } */
/* { dg-add-options bind_pic_locally } */ /* { dg-add-options bind_pic_locally } */
int int
......
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