predict.c (estimate_probability): Remove.

* predict.c (estimate_probability): Remove.
        * profile.c (rest_of_handle_branch_prob, pass_branch_prob): Remove.
        * basic-block.h (estimate_probability): Remove prototype.
        * passes.c (finish_optimization_passes): Dump branch prediction or
        profiling heuristics to the .profile tree dump.
        (init_optimization_passes): Unqueue pass_branch_prob.

        * doc/invoke.texi (-fdump-rtl-bp): Remove.

From-SVN: r111980
This commit is contained in:
Steven Bosscher 2006-03-12 22:58:22 +00:00 committed by Steven Bosscher
parent 189cd5056d
commit 3d47ea88f3
6 changed files with 13 additions and 132 deletions

View file

@ -1,3 +1,14 @@
2006-03-12 Steven Bosscher <stevenb.gcc@gmail.com>
* predict.c (estimate_probability): Remove.
* profile.c (rest_of_handle_branch_prob, pass_branch_prob): Remove.
* basic-block.h (estimate_probability): Remove prototype.
* passes.c (finish_optimization_passes): Dump branch prediction or
profiling heuristics to the .profile tree dump.
(init_optimization_passes): Unqueue pass_branch_prob.
* doc/invoke.texi (-fdump-rtl-bp): Remove.
2006-03-11 Steven Bosscher <stevenb.gcc@gmail.com>
* rtl.def (LABEL_REF): Remove the field for LABEL_NEXTREF.

View file

@ -869,7 +869,6 @@ extern struct edge_list *pre_edge_rev_lcm (int, sbitmap *,
extern void compute_available (sbitmap *, sbitmap *, sbitmap *, sbitmap *);
/* In predict.c */
extern void estimate_probability (struct loops *);
extern void expected_value_to_br_prob (void);
extern bool maybe_hot_bb_p (basic_block);
extern bool probably_cold_bb_p (basic_block);

View file

@ -3712,12 +3712,6 @@ letters for use in @var{letters} and @var{pass}, and their meanings:
@opindex dA
Annotate the assembler output with miscellaneous debugging information.
@item -db
@itemx -fdump-rtl-bp
@opindex db
@opindex fdump-rtl-bp
Dump after computing branch probabilities, to @file{@var{file}.09.bp}.
@item -dB
@itemx -fdump-rtl-bbro
@opindex dB

View file

@ -216,10 +216,10 @@ finish_optimization_passes (void)
timevar_push (TV_DUMP);
if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
{
dump_file = dump_begin (pass_branch_prob.static_pass_number, NULL);
dump_file = dump_begin (pass_profile.static_pass_number, NULL);
end_branch_prob ();
if (dump_file)
dump_end (pass_branch_prob.static_pass_number, dump_file);
dump_end (pass_profile.static_pass_number, dump_file);
}
if (optimize > 0)
@ -635,7 +635,6 @@ init_optimization_passes (void)
NEXT_PASS (pass_gcse);
NEXT_PASS (pass_jump_bypass);
NEXT_PASS (pass_cfg);
NEXT_PASS (pass_branch_prob);
NEXT_PASS (pass_rtl_ifcvt);
NEXT_PASS (pass_tracer);
/* Perform loop optimizations. It might be better to do them a bit

View file

@ -826,85 +826,6 @@ bb_estimate_probability_locally (basic_block bb)
}
}
/* Statically estimate the probability that a branch will be taken and produce
estimated profile. When profile feedback is present never executed portions
of function gets estimated. */
void
estimate_probability (struct loops *loops_info)
{
basic_block bb;
connect_infinite_loops_to_exit ();
calculate_dominance_info (CDI_DOMINATORS);
calculate_dominance_info (CDI_POST_DOMINATORS);
predict_loops (loops_info, true);
iv_analysis_done ();
/* Attempt to predict conditional jumps using a number of heuristics. */
FOR_EACH_BB (bb)
{
rtx last_insn = BB_END (bb);
edge e;
edge_iterator ei;
if (! can_predict_insn_p (last_insn))
continue;
FOR_EACH_EDGE (e, ei, bb->succs)
{
/* Predict early returns to be probable, as we've already taken
care for error returns and other are often used for fast paths
trought function. */
if ((e->dest == EXIT_BLOCK_PTR
|| (single_succ_p (e->dest)
&& single_succ (e->dest) == EXIT_BLOCK_PTR))
&& !predicted_by_p (bb, PRED_NULL_RETURN)
&& !predicted_by_p (bb, PRED_CONST_RETURN)
&& !predicted_by_p (bb, PRED_NEGATIVE_RETURN)
&& !last_basic_block_p (e->dest))
predict_edge_def (e, PRED_EARLY_RETURN, TAKEN);
/* Look for block we are guarding (i.e. we dominate it,
but it doesn't postdominate us). */
if (e->dest != EXIT_BLOCK_PTR && e->dest != bb
&& dominated_by_p (CDI_DOMINATORS, e->dest, e->src)
&& !dominated_by_p (CDI_POST_DOMINATORS, e->src, e->dest))
{
rtx insn;
/* The call heuristic claims that a guarded function call
is improbable. This is because such calls are often used
to signal exceptional situations such as printing error
messages. */
for (insn = BB_HEAD (e->dest); insn != NEXT_INSN (BB_END (e->dest));
insn = NEXT_INSN (insn))
if (CALL_P (insn)
/* Constant and pure calls are hardly used to signalize
something exceptional. */
&& ! CONST_OR_PURE_CALL_P (insn))
{
predict_edge_def (e, PRED_CALL, NOT_TAKEN);
break;
}
}
}
bb_estimate_probability_locally (bb);
}
/* Attach the combined probability to each conditional jump. */
FOR_EACH_BB (bb)
combine_predictions_for_insn (BB_END (bb), bb);
remove_fake_edges ();
estimate_bb_frequencies (loops_info);
free_dominance_info (CDI_POST_DOMINATORS);
if (profile_status == PROFILE_ABSENT)
profile_status = PROFILE_GUESSED;
}
/* Set edge->probability for each successor edge of BB. */
void
guess_outgoing_edge_probabilities (basic_block bb)

View file

@ -1336,46 +1336,3 @@ tree_register_profile_hooks (void)
profile_hooks = &tree_profile_hooks;
}
/* Do branch profiling and static profile estimation passes. */
static unsigned int
rest_of_handle_branch_prob (void)
{
struct loops loops;
/* Discover and record the loop depth at the head of each basic
block. The loop infrastructure does the real job for us. */
flow_loops_find (&loops);
if (dump_file)
flow_loops_dump (&loops, dump_file, NULL, 0);
/* Estimate using heuristics if no profiling info is available. */
if (flag_guess_branch_prob
&& profile_status == PROFILE_ABSENT)
estimate_probability (&loops);
flow_loops_free (&loops);
free_dominance_info (CDI_DOMINATORS);
return 0;
}
struct tree_opt_pass pass_branch_prob =
{
"bp", /* name */
NULL, /* gate */
rest_of_handle_branch_prob, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
TV_BRANCH_PROB, /* tv_id */
0, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
TODO_dump_func, /* todo_flags_finish */
'b' /* letter */
};