Commit f7725a48 by Martin Jambor Committed by Martin Jambor

IPA-CP: Always access param_ipcp_unit_growth through opt_for_fn

2020-01-10  Martin Jambor  <mjambor@suse.cz>

	* params.opt (param_ipcp_unit_growth): Mark as Optimization.
	* ipa-cp.c (max_new_size): Removed.
	(orig_overall_size): New variable.
	(get_max_overall_size): New function.
	(estimate_local_effects): Use it.  Adjust dump.
	(decide_about_value): Likewise.
	(ipcp_propagate_stage): Do not calculate max_new_size, just store
	orig_overall_size.  Adjust dump.
	(ipa_cp_c_finalize): Clear orig_overall_size instead of max_new_size.

From-SVN: r280099
parent de2e0835
2020-01-10 Martin Jambor <mjambor@suse.cz>
* params.opt (param_ipcp_unit_growth): Mark as Optimization.
* ipa-cp.c (max_new_size): Removed.
(orig_overall_size): New variable.
(get_max_overall_size): New function.
(estimate_local_effects): Use it. Adjust dump.
(decide_about_value): Likewise.
(ipcp_propagate_stage): Do not calculate max_new_size, just store
orig_overall_size. Adjust dump.
(ipa_cp_c_finalize): Clear orig_overall_size instead of max_new_size.
2020-01-10 Martin Jambor <mjambor@suse.cz>
* params.opt (param_ipa_max_agg_items): Mark as Optimization
* ipa-cp.c (merge_agg_lats_step): New parameter max_agg_items, use
instead of param_ipa_max_agg_items.
......
......@@ -375,7 +375,7 @@ static profile_count max_count;
/* Original overall size of the program. */
static long overall_size, max_new_size;
static long overall_size, orig_overall_size;
/* Node name to unique clone suffix number map. */
static hash_map<const char *, unsigned> *clone_num_suffixes;
......@@ -3420,6 +3420,23 @@ perform_estimation_of_a_value (cgraph_node *node, vec<tree> known_csts,
val->local_size_cost = size;
}
/* Get the overall limit oof growth based on parameters extracted from growth.
it does not really make sense to mix functions with different overall growth
limits but it is possible and if it happens, we do not want to select one
limit at random. */
static long
get_max_overall_size (cgraph_node *node)
{
long max_new_size = orig_overall_size;
long large_unit = opt_for_fn (node->decl, param_large_unit_insns);
if (max_new_size < large_unit)
max_new_size = large_unit;
int unit_growth = opt_for_fn (node->decl, param_ipcp_unit_growth);
max_new_size += max_new_size * unit_growth / 100 + 1;
return max_new_size;
}
/* Iterate over known values of parameters of NODE and estimate the local
effects in terms of time and size they have. */
......@@ -3482,7 +3499,7 @@ estimate_local_effects (struct cgraph_node *node)
stats.freq_sum, stats.count_sum,
size))
{
if (size + overall_size <= max_new_size)
if (size + overall_size <= get_max_overall_size (node))
{
info->do_clone_for_all_contexts = true;
overall_size += size;
......@@ -3492,8 +3509,8 @@ estimate_local_effects (struct cgraph_node *node)
"known contexts, growth deemed beneficial.\n");
}
else if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " Not cloning for all contexts because "
"max_new_size would be reached with %li.\n",
fprintf (dump_file, " Not cloning for all contexts because "
"maximum unit size would be reached with %li.\n",
size + overall_size);
}
else if (dump_file && (dump_flags & TDF_DETAILS))
......@@ -3885,14 +3902,10 @@ ipcp_propagate_stage (class ipa_topo_info *topo)
max_count = max_count.max (node->count.ipa ());
}
max_new_size = overall_size;
if (max_new_size < param_large_unit_insns)
max_new_size = param_large_unit_insns;
max_new_size += max_new_size * param_ipa_cp_unit_growth / 100 + 1;
orig_overall_size = overall_size;
if (dump_file)
fprintf (dump_file, "\noverall_size: %li, max_new_size: %li\n",
overall_size, max_new_size);
fprintf (dump_file, "\noverall_size: %li\n", overall_size);
propagate_constants_topo (topo);
if (flag_checking)
......@@ -5405,11 +5418,11 @@ decide_about_value (struct cgraph_node *node, int index, HOST_WIDE_INT offset,
perhaps_add_new_callers (node, val);
return false;
}
else if (val->local_size_cost + overall_size > max_new_size)
else if (val->local_size_cost + overall_size > get_max_overall_size (node))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " Ignoring candidate value because "
"max_new_size would be reached with %li.\n",
"maximum unit size would be reached with %li.\n",
val->local_size_cost + overall_size);
return false;
}
......@@ -5953,6 +5966,6 @@ ipa_cp_c_finalize (void)
{
max_count = profile_count::uninitialized ();
overall_size = 0;
max_new_size = 0;
orig_overall_size = 0;
ipcp_free_transformation_sum ();
}
......@@ -246,6 +246,10 @@ Maximum pieces that IPA-SRA tracks per formal parameter, as a consequence, also
Common Joined UInteger Var(param_ipa_sra_ptr_growth_factor) Init(2) Param Optimization
Maximum allowed growth of number and total size of new parameters that ipa-sra replaces a pointer to an aggregate with.
-param=ipcp-unit-growth=
Common Joined UInteger Var(param_ipcp_unit_growth) Optimization Init(10) Param
How much can given compilation unit grow because of the interprocedural constant propagation (in percent).
-param=ira-loop-reserved-regs=
Common Joined UInteger Var(param_ira_loop_reserved_regs) Init(2) Param Optimization
The number of registers in each class kept unused by loop invariant motion.
......
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