Eliminate profile_status macro.
gcc/ * basic-block.h (profile_status): Eliminate macro. * cfgbuild.c (find_many_sub_basic_blocks): Eliminate use of profile_status macro in favor of profile_status_for_fn, making use of cfun explicit. * cfghooks.c (account_profile_record): Likewise. * cfgloopanal.c (single_likely_exit): * cfgrtl.c (rtl_verify_edges, rtl_account_profile_record): Likewise. * graphite.c (graphite_finalize): * internal-fn.c (ubsan_expand_si_overflow_addsub_check, ubsan_expand_si_overflow_neg_check, ubsan_expand_si_overflow_mul_check): Likewise. * ipa-split.c (consider_split, execute_split_functions): * loop-unroll.c (decide_peel_simple): * optabs.c (emit_cmp_and_jump_insn_1): * predict.c (maybe_hot_edge_p, probably_never_executed, predictable_edge_p, probability_reliable_p, gimple_predict_edge, tree_estimate_probability_driver, estimate_bb_frequencies, compute_function_frequency, rebuild_frequencies): Likewise. * profile.c (compute_branch_probabilities): Likewise. * tree-cfg.c (gimple_account_profile_record): Likewise. * tree-inline.c (optimize_inline_calls): Likewise. From-SVN: r205825
This commit is contained in:
parent
99729d912d
commit
0a6a6ac91c
|
@ -1,3 +1,28 @@
|
|||
2013-12-09 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* basic-block.h (profile_status): Eliminate macro.
|
||||
|
||||
* cfgbuild.c (find_many_sub_basic_blocks): Eliminate use of
|
||||
profile_status macro in favor of profile_status_for_fn, making
|
||||
use of cfun explicit.
|
||||
* cfghooks.c (account_profile_record): Likewise.
|
||||
* cfgloopanal.c (single_likely_exit):
|
||||
* cfgrtl.c (rtl_verify_edges, rtl_account_profile_record): Likewise.
|
||||
* graphite.c (graphite_finalize):
|
||||
* internal-fn.c (ubsan_expand_si_overflow_addsub_check,
|
||||
ubsan_expand_si_overflow_neg_check,
|
||||
ubsan_expand_si_overflow_mul_check): Likewise.
|
||||
* ipa-split.c (consider_split, execute_split_functions):
|
||||
* loop-unroll.c (decide_peel_simple):
|
||||
* optabs.c (emit_cmp_and_jump_insn_1):
|
||||
* predict.c (maybe_hot_edge_p, probably_never_executed,
|
||||
predictable_edge_p, probability_reliable_p, gimple_predict_edge,
|
||||
tree_estimate_probability_driver, estimate_bb_frequencies,
|
||||
compute_function_frequency, rebuild_frequencies): Likewise.
|
||||
* profile.c (compute_branch_probabilities): Likewise.
|
||||
* tree-cfg.c (gimple_account_profile_record): Likewise.
|
||||
* tree-inline.c (optimize_inline_calls): Likewise.
|
||||
|
||||
2013-12-09 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* basic-block.h (label_to_block_map): Eliminate macro.
|
||||
|
|
|
@ -328,7 +328,6 @@ struct GTY(()) control_flow_graph {
|
|||
|
||||
/* Defines for textual backward source compatibility. */
|
||||
#define last_basic_block (cfun->cfg->x_last_basic_block)
|
||||
#define profile_status (cfun->cfg->x_profile_status)
|
||||
|
||||
/* For iterating over basic blocks. */
|
||||
#define FOR_BB_BETWEEN(BB, FROM, TO, DIR) \
|
||||
|
|
|
@ -618,7 +618,7 @@ find_many_sub_basic_blocks (sbitmap blocks)
|
|||
|
||||
/* Update branch probabilities. Expect only (un)conditional jumps
|
||||
to be created with only the forward edges. */
|
||||
if (profile_status != PROFILE_ABSENT)
|
||||
if (profile_status_for_fn (cfun) != PROFILE_ABSENT)
|
||||
FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
|
||||
{
|
||||
edge e;
|
||||
|
|
|
@ -1411,7 +1411,7 @@ account_profile_record (struct profile_record *record, int after_pass)
|
|||
FOR_ALL_BB (bb)
|
||||
{
|
||||
if (bb != EXIT_BLOCK_PTR_FOR_FN (cfun)
|
||||
&& profile_status != PROFILE_ABSENT)
|
||||
&& profile_status_for_fn (cfun) != PROFILE_ABSENT)
|
||||
{
|
||||
sum = 0;
|
||||
FOR_EACH_EDGE (e, ei, bb->succs)
|
||||
|
@ -1426,7 +1426,7 @@ account_profile_record (struct profile_record *record, int after_pass)
|
|||
record->num_mismatched_count_out[after_pass]++;
|
||||
}
|
||||
if (bb != ENTRY_BLOCK_PTR_FOR_FN (cfun)
|
||||
&& profile_status != PROFILE_ABSENT)
|
||||
&& profile_status_for_fn (cfun) != PROFILE_ABSENT)
|
||||
{
|
||||
sum = 0;
|
||||
FOR_EACH_EDGE (e, ei, bb->preds)
|
||||
|
|
|
@ -470,7 +470,7 @@ single_likely_exit (struct loop *loop)
|
|||
ruled out by this test. The static branch prediction algorithm
|
||||
will not assign such a low probability to conditionals for usual
|
||||
reasons. */
|
||||
if (profile_status != PROFILE_ABSENT
|
||||
if (profile_status_for_fn (cfun) != PROFILE_ABSENT
|
||||
&& ex->probability < 5 && !ex->count)
|
||||
continue;
|
||||
if (!found)
|
||||
|
|
|
@ -2420,7 +2420,7 @@ rtl_verify_edges (void)
|
|||
&& any_condjump_p (BB_END (bb)))
|
||||
{
|
||||
if (XINT (note, 0) != BRANCH_EDGE (bb)->probability
|
||||
&& profile_status != PROFILE_ABSENT)
|
||||
&& profile_status_for_fn (cfun) != PROFILE_ABSENT)
|
||||
{
|
||||
error ("verify_flow_info: REG_BR_PROB does not match cfg %i %i",
|
||||
XINT (note, 0), BRANCH_EDGE (bb)->probability);
|
||||
|
@ -5011,10 +5011,10 @@ rtl_account_profile_record (basic_block bb, int after_pass,
|
|||
{
|
||||
record->size[after_pass]
|
||||
+= insn_rtx_cost (PATTERN (insn), false);
|
||||
if (profile_status == PROFILE_READ)
|
||||
if (profile_status_for_fn (cfun) == PROFILE_READ)
|
||||
record->time[after_pass]
|
||||
+= insn_rtx_cost (PATTERN (insn), true) * bb->count;
|
||||
else if (profile_status == PROFILE_GUESSED)
|
||||
else if (profile_status_for_fn (cfun) == PROFILE_GUESSED)
|
||||
record->time[after_pass]
|
||||
+= insn_rtx_cost (PATTERN (insn), true) * bb->frequency;
|
||||
}
|
||||
|
|
|
@ -245,7 +245,7 @@ graphite_finalize (bool need_cfg_cleanup_p)
|
|||
{
|
||||
scev_reset ();
|
||||
cleanup_tree_cfg ();
|
||||
profile_status = PROFILE_ABSENT;
|
||||
profile_status_for_fn (cfun) = PROFILE_ABSENT;
|
||||
release_recorded_exits ();
|
||||
tree_estimate_probability ();
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ ubsan_expand_si_overflow_addsub_check (tree_code code, gimple stmt)
|
|||
if (maybe_expand_insn (icode, 4, ops))
|
||||
{
|
||||
last = get_last_insn ();
|
||||
if (profile_status != PROFILE_ABSENT
|
||||
if (profile_status_for_fn (cfun) != PROFILE_ABSENT
|
||||
&& JUMP_P (last)
|
||||
&& any_condjump_p (last)
|
||||
&& !find_reg_note (last, REG_BR_PROB, 0))
|
||||
|
@ -285,7 +285,7 @@ ubsan_expand_si_overflow_neg_check (gimple stmt)
|
|||
if (maybe_expand_insn (icode, 3, ops))
|
||||
{
|
||||
last = get_last_insn ();
|
||||
if (profile_status != PROFILE_ABSENT
|
||||
if (profile_status_for_fn (cfun) != PROFILE_ABSENT
|
||||
&& JUMP_P (last)
|
||||
&& any_condjump_p (last)
|
||||
&& !find_reg_note (last, REG_BR_PROB, 0))
|
||||
|
@ -364,7 +364,7 @@ ubsan_expand_si_overflow_mul_check (gimple stmt)
|
|||
if (maybe_expand_insn (icode, 4, ops))
|
||||
{
|
||||
last = get_last_insn ();
|
||||
if (profile_status != PROFILE_ABSENT
|
||||
if (profile_status_for_fn (cfun) != PROFILE_ABSENT
|
||||
&& JUMP_P (last)
|
||||
&& any_condjump_p (last)
|
||||
&& !find_reg_note (last, REG_BR_PROB, 0))
|
||||
|
|
|
@ -411,7 +411,7 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
|
|||
a loop, enable splitting since inlining code skipping the loop
|
||||
is likely noticeable win. */
|
||||
if (back_edge
|
||||
&& profile_status != PROFILE_READ
|
||||
&& profile_status_for_fn (cfun) != PROFILE_READ
|
||||
&& incoming_freq < ENTRY_BLOCK_PTR_FOR_FN (cfun)->frequency)
|
||||
{
|
||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
|
@ -1585,7 +1585,7 @@ execute_split_functions (void)
|
|||
|
||||
/* We enforce splitting after loop headers when profile info is not
|
||||
available. */
|
||||
if (profile_status != PROFILE_READ)
|
||||
if (profile_status_for_fn (cfun) != PROFILE_READ)
|
||||
mark_dfs_back_edges ();
|
||||
|
||||
/* Initialize bitmap to track forbidden calls. */
|
||||
|
|
|
@ -1371,7 +1371,7 @@ decide_peel_simple (struct loop *loop, int flags)
|
|||
also branch from branch prediction POV (and probably better reason
|
||||
to not unroll/peel). */
|
||||
if (num_loop_branches (loop) > 1
|
||||
&& profile_status != PROFILE_READ)
|
||||
&& profile_status_for_fn (cfun) != PROFILE_READ)
|
||||
{
|
||||
if (dump_file)
|
||||
fprintf (dump_file, ";; Not peeling, contains branches\n");
|
||||
|
|
|
@ -4286,7 +4286,7 @@ emit_cmp_and_jump_insn_1 (rtx test, enum machine_mode mode, rtx label, int prob)
|
|||
insn = emit_jump_insn (GEN_FCN (icode) (test, XEXP (test, 0),
|
||||
XEXP (test, 1), label));
|
||||
if (prob != -1
|
||||
&& profile_status != PROFILE_ABSENT
|
||||
&& profile_status_for_fn (cfun) != PROFILE_ABSENT
|
||||
&& insn
|
||||
&& JUMP_P (insn)
|
||||
&& any_condjump_p (insn)
|
||||
|
|
|
@ -224,7 +224,7 @@ cgraph_maybe_hot_edge_p (struct cgraph_edge *edge)
|
|||
bool
|
||||
maybe_hot_edge_p (edge e)
|
||||
{
|
||||
if (profile_status == PROFILE_READ)
|
||||
if (profile_status_for_fn (cfun) == PROFILE_READ)
|
||||
return maybe_hot_count_p (cfun, e->count);
|
||||
return maybe_hot_frequency_p (cfun, EDGE_FREQUENCY (e));
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ probably_never_executed (struct function *fun,
|
|||
gcov_type count, int frequency)
|
||||
{
|
||||
gcc_checking_assert (fun);
|
||||
if (profile_status_for_fn (fun) == PROFILE_READ)
|
||||
if (profile_status_for_fn (cfun) == PROFILE_READ)
|
||||
{
|
||||
int unlikely_count_fraction = PARAM_VALUE (UNLIKELY_BB_COUNT_FRACTION);
|
||||
if (count * unlikely_count_fraction >= profile_info->runs)
|
||||
|
@ -438,7 +438,7 @@ optimize_loop_nest_for_size_p (struct loop *loop)
|
|||
bool
|
||||
predictable_edge_p (edge e)
|
||||
{
|
||||
if (profile_status == PROFILE_ABSENT)
|
||||
if (profile_status_for_fn (cfun) == PROFILE_ABSENT)
|
||||
return false;
|
||||
if ((e->probability
|
||||
<= PARAM_VALUE (PARAM_PREDICTABLE_BRANCH_OUTCOME) * REG_BR_PROB_BASE / 100)
|
||||
|
@ -539,8 +539,8 @@ gimple_predicted_by_p (const_basic_block bb, enum br_predictor predictor)
|
|||
static bool
|
||||
probability_reliable_p (int prob)
|
||||
{
|
||||
return (profile_status == PROFILE_READ
|
||||
|| (profile_status == PROFILE_GUESSED
|
||||
return (profile_status_for_fn (cfun) == PROFILE_READ
|
||||
|| (profile_status_for_fn (cfun) == PROFILE_GUESSED
|
||||
&& (prob <= HITRATE (1) || prob >= HITRATE (99))));
|
||||
}
|
||||
|
||||
|
@ -610,7 +610,7 @@ rtl_predict_edge (edge e, enum br_predictor predictor, int probability)
|
|||
void
|
||||
gimple_predict_edge (edge e, enum br_predictor predictor, int probability)
|
||||
{
|
||||
gcc_assert (profile_status != PROFILE_GUESSED);
|
||||
gcc_assert (profile_status_for_fn (cfun) != PROFILE_GUESSED);
|
||||
if ((e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun) && EDGE_COUNT (e->src->succs) >
|
||||
1)
|
||||
&& flag_guess_branch_prob && optimize)
|
||||
|
@ -2443,8 +2443,8 @@ tree_estimate_probability_driver (void)
|
|||
loop_optimizer_finalize ();
|
||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
gimple_dump_cfg (dump_file, dump_flags);
|
||||
if (profile_status == PROFILE_ABSENT)
|
||||
profile_status = PROFILE_GUESSED;
|
||||
if (profile_status_for_fn (cfun) == PROFILE_ABSENT)
|
||||
profile_status_for_fn (cfun) = PROFILE_GUESSED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2954,7 +2954,7 @@ estimate_bb_frequencies (bool force)
|
|||
basic_block bb;
|
||||
sreal freq_max;
|
||||
|
||||
if (force || profile_status != PROFILE_READ || !counts_to_freqs ())
|
||||
if (force || profile_status_for_fn (cfun) != PROFILE_READ || !counts_to_freqs ())
|
||||
{
|
||||
static int real_values_initialized = 0;
|
||||
|
||||
|
@ -3030,7 +3030,7 @@ compute_function_frequency (void)
|
|||
if (DECL_STATIC_DESTRUCTOR (current_function_decl))
|
||||
node->only_called_at_exit = true;
|
||||
|
||||
if (profile_status != PROFILE_READ)
|
||||
if (profile_status_for_fn (cfun) != PROFILE_READ)
|
||||
{
|
||||
int flags = flags_from_decl_or_type (current_function_decl);
|
||||
if (lookup_attribute ("cold", DECL_ATTRIBUTES (current_function_decl))
|
||||
|
@ -3189,8 +3189,8 @@ rebuild_frequencies (void)
|
|||
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (cfun), NULL, next_bb)
|
||||
count_max = MAX (bb->count, count_max);
|
||||
|
||||
if (profile_status == PROFILE_GUESSED
|
||||
|| (profile_status == PROFILE_READ && count_max < REG_BR_PROB_BASE/10))
|
||||
if (profile_status_for_fn (cfun) == PROFILE_GUESSED
|
||||
|| (profile_status_for_fn (cfun) == PROFILE_READ && count_max < REG_BR_PROB_BASE/10))
|
||||
{
|
||||
loop_optimizer_init (0);
|
||||
add_noreturn_fake_exit_edges ();
|
||||
|
@ -3200,7 +3200,7 @@ rebuild_frequencies (void)
|
|||
remove_fake_exit_edges ();
|
||||
loop_optimizer_finalize ();
|
||||
}
|
||||
else if (profile_status == PROFILE_READ)
|
||||
else if (profile_status_for_fn (cfun) == PROFILE_READ)
|
||||
counts_to_freqs ();
|
||||
else
|
||||
gcc_unreachable ();
|
||||
|
|
|
@ -797,7 +797,7 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum)
|
|||
give all abnormals frequency of 0, otherwise distribute the
|
||||
frequency over abnormals (this is the case of noreturn
|
||||
calls). */
|
||||
else if (profile_status == PROFILE_ABSENT)
|
||||
else if (profile_status_for_fn (cfun) == PROFILE_ABSENT)
|
||||
{
|
||||
int total = 0;
|
||||
|
||||
|
@ -825,7 +825,7 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum)
|
|||
}
|
||||
}
|
||||
counts_to_freqs ();
|
||||
profile_status = PROFILE_READ;
|
||||
profile_status_for_fn (cfun) = PROFILE_READ;
|
||||
compute_function_frequency ();
|
||||
|
||||
if (dump_file)
|
||||
|
|
|
@ -7875,11 +7875,11 @@ gimple_account_profile_record (basic_block bb, int after_pass,
|
|||
{
|
||||
record->size[after_pass]
|
||||
+= estimate_num_insns (gsi_stmt (i), &eni_size_weights);
|
||||
if (profile_status == PROFILE_READ)
|
||||
if (profile_status_for_fn (cfun) == PROFILE_READ)
|
||||
record->time[after_pass]
|
||||
+= estimate_num_insns (gsi_stmt (i),
|
||||
&eni_time_weights) * bb->count;
|
||||
else if (profile_status == PROFILE_GUESSED)
|
||||
else if (profile_status_for_fn (cfun) == PROFILE_GUESSED)
|
||||
record->time[after_pass]
|
||||
+= estimate_num_insns (gsi_stmt (i),
|
||||
&eni_time_weights) * bb->frequency;
|
||||
|
|
|
@ -4612,7 +4612,8 @@ optimize_inline_calls (tree fn)
|
|||
| TODO_cleanup_cfg
|
||||
| (gimple_in_ssa_p (cfun) ? TODO_remove_unused_locals : 0)
|
||||
| (gimple_in_ssa_p (cfun) ? TODO_update_address_taken : 0)
|
||||
| (profile_status != PROFILE_ABSENT ? TODO_rebuild_frequencies : 0));
|
||||
| (profile_status_for_fn (cfun) != PROFILE_ABSENT
|
||||
? TODO_rebuild_frequencies : 0));
|
||||
}
|
||||
|
||||
/* Passed to walk_tree. Copies the node pointed to, if appropriate. */
|
||||
|
|
Loading…
Reference in New Issue