+2020-01-09 Martin Liska <mliska@suse.cz>
+
+ * auto-profile.c (auto_profile): Use opt_for_fn
+ for a parameter.
+ * ipa-cp.c (ipcp_lattice::add_value): Likewise.
+ (propagate_vals_across_arith_jfunc): Likewise.
+ (hint_time_bonus): Likewise.
+ (incorporate_penalties): Likewise.
+ (good_cloning_opportunity_p): Likewise.
+ (perform_estimation_of_a_value): Likewise.
+ (estimate_local_effects): Likewise.
+ (ipcp_propagate_stage): Likewise.
+ * ipa-fnsummary.c (decompose_param_expr): Likewise.
+ (set_switch_stmt_execution_predicate): Likewise.
+ (analyze_function_body): Likewise.
+ * ipa-inline-analysis.c (offline_size): Likewise.
+ * ipa-inline.c (early_inliner): Likewise.
+ * ipa-prop.c (ipa_analyze_node): Likewise.
+ (ipcp_transform_function): Likewise.
+ * ipa-sra.c (process_scan_results): Likewise.
+ (ipa_sra_summarize_function): Likewise.
+ * params.opt: Rename ipcp-unit-growth to
+ ipa-cp-unit-growth. Add Optimization for various
+ IPA-related parameters.
+
2020-01-09 Richard Biener <rguenther@suse.de>
PR middle-end/93054
function before annotation, so the profile inside bar@loc_foo2
will be useful. */
autofdo::stmt_set promoted_stmts;
- for (int i = 0; i < param_early_inliner_max_iterations; i++)
+ for (int i = 0; i < opt_for_fn (node->decl,
+ param_early_inliner_max_iterations); i++)
{
if (!flag_value_profile_transformations
|| !autofdo::afdo_vpt_for_early_inline (&promoted_stmts))
return false;
}
- if (!unlimited && values_count == param_ipa_cp_value_list_size)
+ if (!unlimited && values_count == opt_for_fn (cs->caller->decl,
+ param_ipa_cp_value_list_size))
{
/* We can only free sources, not the values themselves, because sources
of other values in this SCC might point to them. */
{
int i;
- if (src_lat != dest_lat || param_ipa_cp_max_recursive_depth < 1)
+ int max_recursive_depth = opt_for_fn(cs->caller->decl,
+ param_ipa_cp_max_recursive_depth);
+ if (src_lat != dest_lat || max_recursive_depth < 1)
return dest_lat->set_contains_variable ();
/* No benefit if recursive execution is in low probability. */
if (cs->sreal_frequency () * 100
- <= ((sreal) 1) * param_ipa_cp_min_recursive_probability)
+ <= ((sreal) 1) * opt_for_fn (cs->caller->decl,
+ param_ipa_cp_min_recursive_probability))
return dest_lat->set_contains_variable ();
auto_vec<ipcp_value<tree> *, 8> val_seeds;
/* Recursively generate lattice values with a limited count. */
FOR_EACH_VEC_ELT (val_seeds, i, src_val)
{
- for (int j = 1; j < param_ipa_cp_max_recursive_depth; j++)
+ for (int j = 1; j < max_recursive_depth; j++)
{
tree cstval = get_val_across_arith_op (opcode, opnd1_type, opnd2,
src_val, res_type);
/* Return time bonus incurred because of HINTS. */
static int
-hint_time_bonus (ipa_hints hints)
+hint_time_bonus (cgraph_node *node, ipa_hints hints)
{
int result = 0;
if (hints & (INLINE_HINT_loop_iterations | INLINE_HINT_loop_stride))
- result += param_ipa_cp_loop_hint_bonus;
+ result += opt_for_fn (node->decl, param_ipa_cp_loop_hint_bonus);
return result;
}
cloning goodness evaluation, do so. */
static inline int64_t
-incorporate_penalties (ipa_node_params *info, int64_t evaluation)
+incorporate_penalties (cgraph_node *node, ipa_node_params *info,
+ int64_t evaluation)
{
if (info->node_within_scc && !info->node_is_self_scc)
evaluation = (evaluation
- * (100 - param_ipa_cp_recursion_penalty)) / 100;
+ * (100 - opt_for_fn (node->decl,
+ param_ipa_cp_recursion_penalty))) / 100;
if (info->node_calling_single_call)
evaluation = (evaluation
- * (100 - param_ipa_cp_single_call_penalty))
+ * (100 - opt_for_fn (node->decl,
+ param_ipa_cp_single_call_penalty)))
/ 100;
return evaluation;
gcc_assert (size_cost > 0);
class ipa_node_params *info = IPA_NODE_REF (node);
+ int eval_threshold = opt_for_fn (node->decl, param_ipa_cp_eval_threshold);
if (max_count > profile_count::zero ())
{
int factor = RDIV (count_sum.probability_in
* 1000, REG_BR_PROB_BASE);
int64_t evaluation = (((int64_t) time_benefit * factor)
/ size_cost);
- evaluation = incorporate_penalties (info, evaluation);
+ evaluation = incorporate_penalties (node, info, evaluation);
if (dump_file && (dump_flags & TDF_DETAILS))
{
info->node_within_scc
? (info->node_is_self_scc ? ", self_scc" : ", scc") : "",
info->node_calling_single_call ? ", single_call" : "",
- evaluation, param_ipa_cp_eval_threshold);
+ evaluation, eval_threshold);
}
- return evaluation >= param_ipa_cp_eval_threshold;
+ return evaluation >= eval_threshold;
}
else
{
int64_t evaluation = (((int64_t) time_benefit * freq_sum)
/ size_cost);
- evaluation = incorporate_penalties (info, evaluation);
+ evaluation = incorporate_penalties (node, info, evaluation);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " good_cloning_opportunity_p (time: %i, "
info->node_within_scc
? (info->node_is_self_scc ? ", self_scc" : ", scc") : "",
info->node_calling_single_call ? ", single_call" : "",
- evaluation, param_ipa_cp_eval_threshold);
+ evaluation, eval_threshold);
- return evaluation >= param_ipa_cp_eval_threshold;
+ return evaluation >= eval_threshold;
}
}
time_benefit = base_time.to_int ()
+ devirtualization_time_bonus (node, known_csts, known_contexts,
known_aggs)
- + hint_time_bonus (hints)
+ + hint_time_bonus (node, hints)
+ removable_params_cost + est_move_cost;
gcc_checking_assert (size >=0);
known_aggs, &size, &time,
&base_time, &hints);
time -= devirt_bonus;
- time -= hint_time_bonus (hints);
+ time -= hint_time_bonus (node, hints);
time -= removable_params_cost;
size -= stats.n_calls * removable_params_cost;
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_ipcp_unit_growth / 100 + 1;
+ max_new_size += max_new_size * param_ipa_cp_unit_growth / 100 + 1;
if (dump_file)
fprintf (dump_file, "\noverall_size: %li, max_new_size: %li\n",
struct agg_position_info *aggpos,
expr_eval_ops *param_ops_p = NULL)
{
- int op_limit = param_ipa_max_param_expr_ops;
+ int op_limit = opt_for_fn (fbi->node->decl, param_ipa_max_param_expr_ops);
int op_count = 0;
if (param_ops_p)
auto_vec<std::pair<tree, tree> > ranges;
tree type = TREE_TYPE (op);
- int bound_limit = param_ipa_max_switch_predicate_bounds;
+ int bound_limit = opt_for_fn (fbi->node->decl,
+ param_ipa_max_switch_predicate_bounds);
int bound_count = 0;
wide_int vr_wmin, vr_wmax;
value_range_kind vr_type = get_range_info (op, &vr_wmin, &vr_wmax);
fbi.bb_infos = vNULL;
fbi.bb_infos.safe_grow_cleared (last_basic_block_for_fn (cfun));
fbi.param_count = count_formal_params (node->decl);
- fbi.aa_walk_budget = param_ipa_max_aa_steps;
+ fbi.aa_walk_budget = opt_for_fn (node->decl, param_ipa_max_aa_steps);
nonconstant_names.safe_grow_cleared
(SSANAMES (my_function)->length ());
Take this into account. */
else if (DECL_COMDAT (node->decl)
&& node->can_remove_if_no_direct_calls_p ())
- return (info->size
- * (100 - param_comdat_sharing_probability)
- + 50) / 100;
+ {
+ int prob = opt_for_fn (node->decl, param_comdat_sharing_probability);
+ return info->size * (100 - prob + 50) / 100;
+ }
}
return 0;
}
}
/* We iterate incremental inlining to get trivial cases of indirect
inlining. */
- while (iterations < param_early_inliner_max_iterations
+ while (iterations < opt_for_fn (node->decl,
+ param_early_inliner_max_iterations)
&& early_inline_small_functions (node))
{
timevar_push (TV_INTEGRATION);
es->call_stmt_time
= estimate_num_insns (edge->call_stmt, &eni_time_weights);
}
- if (iterations < param_early_inliner_max_iterations - 1)
+ if (iterations < opt_for_fn (node->decl,
+ param_early_inliner_max_iterations) - 1)
ipa_update_overall_fn_summary (node);
timevar_pop (TV_INTEGRATION);
iterations++;
fbi.bb_infos = vNULL;
fbi.bb_infos.safe_grow_cleared (last_basic_block_for_fn (cfun));
fbi.param_count = ipa_get_param_count (info);
- fbi.aa_walk_budget = param_ipa_max_aa_steps;
+ fbi.aa_walk_budget = opt_for_fn (node->decl, param_ipa_max_aa_steps);
for (struct cgraph_edge *cs = node->callees; cs; cs = cs->next_callee)
{
fbi.bb_infos = vNULL;
fbi.bb_infos.safe_grow_cleared (last_basic_block_for_fn (cfun));
fbi.param_count = param_count;
- fbi.aa_walk_budget = param_ipa_max_aa_steps;
+ fbi.aa_walk_budget = opt_for_fn (node->decl, param_ipa_max_aa_steps);
vec_safe_grow_cleared (descriptors, param_count);
ipa_populate_param_decls (node, *descriptors);
if (!desc->by_ref || optimize_function_for_size_p (fun))
param_size_limit = cur_param_size;
else
- param_size_limit = param_ipa_sra_ptr_growth_factor * cur_param_size;
+ param_size_limit
+ = opt_for_fn (node->decl,
+ param_ipa_sra_ptr_growth_factor) * cur_param_size;
if (nonarg_acc_size > param_size_limit
|| (!desc->by_ref && nonarg_acc_size == param_size_limit))
{
bb_dereferences = XCNEWVEC (HOST_WIDE_INT,
by_ref_count
* last_basic_block_for_fn (fun));
- aa_walking_limit = param_ipa_max_aa_steps;
+ aa_walking_limit = opt_for_fn (node->decl, param_ipa_max_aa_steps);
scan_function (node, fun);
if (dump_file)
The smallest number of different values for which it is best to use a jump-table instead of a tree of conditional branches, if 0, use the default for the machine.
-param=comdat-sharing-probability=
-Common Joined UInteger Var(param_comdat_sharing_probability) Init(20) Param
+Common Joined UInteger Var(param_comdat_sharing_probability) Init(20) Param Optimization
Probability that COMDAT function will be shared with different compilation unit.
-param=cxx-max-namespaces-for-diagnostic-help=
The upper bound for sharing integer constants.
-param=ipa-cp-eval-threshold=
-Common Joined UInteger Var(param_ipa_cp_eval_threshold) Init(500) Param
+Common Joined UInteger Var(param_ipa_cp_eval_threshold) Init(500) Param Optimization
Threshold ipa-cp opportunity evaluation that is still considered beneficial to clone.
-param=ipa-cp-loop-hint-bonus=
-Common Joined UInteger Var(param_ipa_cp_loop_hint_bonus) Init(64) Param
+Common Joined UInteger Var(param_ipa_cp_loop_hint_bonus) Init(64) Param Optimization
Compile-time bonus IPA-CP assigns to candidates which make loop bounds or strides known.
-param=ipa-cp-max-recursive-depth=
-Common Joined UInteger Var(param_ipa_cp_max_recursive_depth) Init(8) Param
+Common Joined UInteger Var(param_ipa_cp_max_recursive_depth) Init(8) Param Optimization
Maximum depth of recursive cloning for self-recursive function.
-param=ipa-cp-min-recursive-probability=
-Common Joined UInteger Var(param_ipa_cp_min_recursive_probability) Init(2) Param
+Common Joined UInteger Var(param_ipa_cp_min_recursive_probability) Init(2) Param Optimization
Recursive cloning only when the probability of call being executed exceeds the parameter.
-param=ipa-cp-recursion-penalty=
-Common Joined UInteger Var(param_ipa_cp_recursion_penalty) Init(40) IntegerRange(0, 100) Param
+Common Joined UInteger Var(param_ipa_cp_recursion_penalty) Init(40) IntegerRange(0, 100) Param Optimization
Percentage penalty the recursive functions will receive when they are evaluated for cloning.
-param=ipa-cp-single-call-penalty=
-Common Joined UInteger Var(param_ipa_cp_single_call_penalty) Init(15) IntegerRange(0, 100) Param
+Common Joined UInteger Var(param_ipa_cp_single_call_penalty) Init(15) IntegerRange(0, 100) Param Optimization
Percentage penalty functions containing a single call to another function will receive when they are evaluated for cloning.
+-param=ipa-cp-unit-growth=
+Common Joined UInteger Var(param_ipa_cp_unit_growth) Init(10) Param
+How much can given compilation unit grow because of the interprocedural constant propagation (in percent).
+
-param=ipa-cp-value-list-size=
-Common Joined UInteger Var(param_ipa_cp_value_list_size) Init(8) Param
+Common Joined UInteger Var(param_ipa_cp_value_list_size) Init(8) Param Optimization
Maximum size of a list of values associated with each parameter for interprocedural constant propagation.
-param=ipa-max-aa-steps=
-Common Joined UInteger Var(param_ipa_max_aa_steps) Init(25000) Param
+Common Joined UInteger Var(param_ipa_max_aa_steps) Init(25000) Param Optimization
Maximum number of statements that will be visited by IPA formal parameter analysis based on alias analysis in any given function.
-param=ipa-max-agg-items=
Maximum number of aggregate content items for a parameter in jump functions and lattices.
-param=ipa-max-param-expr-ops=
-Common Joined UInteger Var(param_ipa_max_param_expr_ops) Init(10) Param
+Common Joined UInteger Var(param_ipa_max_param_expr_ops) Init(10) Param Optimization
Maximum number of operations in a parameter expression that can be handled by IPA analysis.
-param=ipa-max-switch-predicate-bounds=
-Common Joined UInteger Var(param_ipa_max_switch_predicate_bounds) Init(5) Param
+Common Joined UInteger Var(param_ipa_max_switch_predicate_bounds) Init(5) Param Optimization
Maximal number of boundary endpoints of case ranges of switch statement used during IPA functoin summary generation.
-param=ipa-sra-max-replacements=
Maximum pieces that IPA-SRA tracks per formal parameter, as a consequence, also the maximum number of replacements of a formal parameter.
-param=ipa-sra-ptr-growth-factor=
-Common Joined UInteger Var(param_ipa_sra_ptr_growth_factor) Init(2) Param
+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) 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.
Maximum number of active local stores in RTL dead store elimination.
-param=max-early-inliner-iterations=
-Common Joined UInteger Var(param_early_inliner_max_iterations) Init(1) Param
+Common Joined UInteger Var(param_early_inliner_max_iterations) Init(1) Param Optimization
The maximum number of nested indirect inlining performed by early inliner.
-param=max-fields-for-field-sensitive=