Commit a00d11f0 by Jan Hubicka Committed by Jan Hubicka

predict.c (tree_predict_edge): Don't drop useless predictions; check that it is…

predict.c (tree_predict_edge): Don't drop useless predictions; check that it is not called too late in the game.


	* predict.c (tree_predict_edge): Don't drop useless predictions;
	check that it is not called too late in the game.
	(gate_estimate_probability): New gate.
	(pass_profile): Gate.
	* tree-mudflap.c (mf_build_check_statement_for): Do not drop
	predictions; update CFG instead.
	* cfgrtl.c (rtl_verify_flow_info): Check that predcitions are consumed.

From-SVN: r100662
parent bbf59fad
2005-06-06 Jan Hubicka <jh@suse.cz>
* predict.c (tree_predict_edge): Don't drop useless predictions;
check that it is not called too late in the game.
(gate_estimate_probability): New gate.
(pass_profile): Gate.
* tree-mudflap.c (mf_build_check_statement_for): Do not drop
predictions; update CFG instead.
* cfgrtl.c (rtl_verify_flow_info): Check that predcitions are consumed.
2005-06-06 Jie Zhang <jie.zhang@analog.com> 2005-06-06 Jie Zhang <jie.zhang@analog.com>
* config.gcc (bfin*-uclinux*): New. * config.gcc (bfin*-uclinux*): New.
......
...@@ -2136,6 +2136,12 @@ rtl_verify_flow_info (void) ...@@ -2136,6 +2136,12 @@ rtl_verify_flow_info (void)
edge e; edge e;
edge_iterator ei; edge_iterator ei;
if (bb->predictions)
{
error ("bb prediction set for block %i, but it is not used in RTL land", bb->index);
err = 1;
}
FOR_EACH_EDGE (e, ei, bb->succs) FOR_EACH_EDGE (e, ei, bb->succs)
if (e->flags & EDGE_FALLTHRU) if (e->flags & EDGE_FALLTHRU)
break; break;
......
...@@ -231,8 +231,9 @@ rtl_predict_edge (edge e, enum br_predictor predictor, int probability) ...@@ -231,8 +231,9 @@ rtl_predict_edge (edge e, enum br_predictor predictor, int probability)
void void
tree_predict_edge (edge e, enum br_predictor predictor, int probability) tree_predict_edge (edge e, enum br_predictor predictor, int probability)
{ {
gcc_assert (profile_status != PROFILE_GUESSED);
if ((e->src != ENTRY_BLOCK_PTR && EDGE_COUNT (e->src->succs) > 1) if ((e->src != ENTRY_BLOCK_PTR && EDGE_COUNT (e->src->succs) > 1)
&& flag_guess_branch_prob) && flag_guess_branch_prob && optimize)
{ {
struct edge_prediction *i = ggc_alloc (sizeof (struct edge_prediction)); struct edge_prediction *i = ggc_alloc (sizeof (struct edge_prediction));
...@@ -1926,11 +1927,16 @@ choose_function_section (void) ...@@ -1926,11 +1927,16 @@ choose_function_section (void)
UNLIKELY_EXECUTED_TEXT_SECTION_NAME); UNLIKELY_EXECUTED_TEXT_SECTION_NAME);
} }
static bool
gate_estimate_probability (void)
{
return flag_guess_branch_prob;
}
struct tree_opt_pass pass_profile = struct tree_opt_pass pass_profile =
{ {
"profile", /* name */ "profile", /* name */
NULL, /* gate */ gate_estimate_probability, /* gate */
tree_estimate_probability, /* execute */ tree_estimate_probability, /* execute */
NULL, /* sub */ NULL, /* sub */
NULL, /* next */ NULL, /* next */
......
...@@ -528,14 +528,11 @@ mf_build_check_statement_for (tree base, tree limit, ...@@ -528,14 +528,11 @@ mf_build_check_statement_for (tree base, tree limit,
make_edge (cond_bb, then_bb, EDGE_TRUE_VALUE); make_edge (cond_bb, then_bb, EDGE_TRUE_VALUE);
make_single_succ_edge (then_bb, join_bb, EDGE_FALLTHRU); make_single_succ_edge (then_bb, join_bb, EDGE_FALLTHRU);
/* We expect that the conditional jump we will construct will not
be taken very often as it basically is an exception condition. */
predict_edge_def (single_pred_edge (then_bb), PRED_MUDFLAP, NOT_TAKEN);
/* Mark the pseudo-fallthrough edge from cond_bb to join_bb. */ /* Mark the pseudo-fallthrough edge from cond_bb to join_bb. */
e = find_edge (cond_bb, join_bb); e = find_edge (cond_bb, join_bb);
e->flags = EDGE_FALSE_VALUE; e->flags = EDGE_FALSE_VALUE;
predict_edge_def (e, PRED_MUDFLAP, TAKEN); e->count = cond_bb->count;
e->probability = REG_BR_PROB_BASE;
/* Update dominance info. Note that bb_join's data was /* Update dominance info. Note that bb_join's data was
updated by split_block. */ updated by split_block. */
......
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