summaryrefslogtreecommitdiff
path: root/gcc/cfgrtl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cfgrtl.c')
-rw-r--r--gcc/cfgrtl.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 739d1bb9490..ae469088eec 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1156,7 +1156,6 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout)
e->flags = 0;
e->probability = profile_probability::always ();
- e->count = src->count;
if (e->dest != target)
redirect_edge_succ (e, target);
@@ -1505,9 +1504,7 @@ force_nonfallthru_and_redirect (edge e, basic_block target, rtx jump_label)
int prob = XINT (note, 0);
b->probability = profile_probability::from_reg_br_prob_note (prob);
- b->count = e->count.apply_probability (b->probability);
e->probability -= e->probability;
- e->count -= b->count;
}
}
@@ -1536,6 +1533,7 @@ force_nonfallthru_and_redirect (edge e, basic_block target, rtx jump_label)
basic_block bb = create_basic_block (BB_HEAD (e->dest), NULL,
ENTRY_BLOCK_PTR_FOR_FN (cfun));
+ bb->count = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count;
/* Change the existing edge's source to be the new block, and add
a new edge from the entry block to the new block. */
@@ -1615,7 +1613,7 @@ force_nonfallthru_and_redirect (edge e, basic_block target, rtx jump_label)
if (EDGE_COUNT (e->src->succs) >= 2 || abnormal_edge_flags || asm_goto_edge)
{
rtx_insn *new_head;
- profile_count count = e->count;
+ profile_count count = e->count ();
profile_probability probability = e->probability;
/* Create the new structures. */
@@ -1631,7 +1629,6 @@ force_nonfallthru_and_redirect (edge e, basic_block target, rtx jump_label)
jump_block = create_basic_block (new_head, NULL, e->src);
jump_block->count = count;
- jump_block->frequency = EDGE_FREQUENCY (e);
/* Make sure new block ends up in correct hot/cold section. */
@@ -1640,7 +1637,6 @@ force_nonfallthru_and_redirect (edge e, basic_block target, rtx jump_label)
/* Wire edge in. */
new_edge = make_edge (e->src, jump_block, EDGE_FALLTHRU);
new_edge->probability = probability;
- new_edge->count = count;
/* Redirect old edge. */
redirect_edge_pred (e, jump_block);
@@ -1655,13 +1651,10 @@ force_nonfallthru_and_redirect (edge e, basic_block target, rtx jump_label)
if (asm_goto_edge)
{
new_edge->probability = new_edge->probability.apply_scale (1, 2);
- new_edge->count = new_edge->count.apply_scale (1, 2);
jump_block->count = jump_block->count.apply_scale (1, 2);
- jump_block->frequency /= 2;
edge new_edge2 = make_edge (new_edge->src, target,
e->flags & ~EDGE_FALLTHRU);
new_edge2->probability = probability - new_edge->probability;
- new_edge2->count = count - new_edge->count;
}
new_bb = jump_block;
@@ -2251,9 +2244,23 @@ void
update_br_prob_note (basic_block bb)
{
rtx note;
- if (!JUMP_P (BB_END (bb)) || !BRANCH_EDGE (bb)->probability.initialized_p ())
- return;
note = find_reg_note (BB_END (bb), REG_BR_PROB, NULL_RTX);
+ if (!JUMP_P (BB_END (bb)) || !BRANCH_EDGE (bb)->probability.initialized_p ())
+ {
+ if (note)
+ {
+ rtx *note_link, this_rtx;
+
+ note_link = &REG_NOTES (BB_END (bb));
+ for (this_rtx = *note_link; this_rtx; this_rtx = XEXP (this_rtx, 1))
+ if (this_rtx == note)
+ {
+ *note_link = XEXP (this_rtx, 1);
+ break;
+ }
+ }
+ return;
+ }
if (!note
|| XINT (note, 0) == BRANCH_EDGE (bb)->probability.to_reg_br_prob_note ())
return;
@@ -3155,7 +3162,6 @@ purge_dead_edges (basic_block bb)
if (single_succ_p (bb))
{
single_succ_edge (bb)->probability = profile_probability::always ();
- single_succ_edge (bb)->count = bb->count;
}
else
{
@@ -3168,8 +3174,6 @@ purge_dead_edges (basic_block bb)
b->probability = profile_probability::from_reg_br_prob_note
(XINT (note, 0));
f->probability = b->probability.invert ();
- b->count = bb->count.apply_probability (b->probability);
- f->count = bb->count.apply_probability (f->probability);
}
return purged;
@@ -3221,7 +3225,6 @@ purge_dead_edges (basic_block bb)
gcc_assert (single_succ_p (bb));
single_succ_edge (bb)->probability = profile_probability::always ();
- single_succ_edge (bb)->count = bb->count;
if (dump_file)
fprintf (dump_file, "Purged non-fallthru edges from bb %i\n",
@@ -3633,7 +3636,6 @@ relink_block_chain (bool stay_in_cfglayout_mode)
fprintf (dump_file, "compensation ");
else
fprintf (dump_file, "bb %i ", bb->index);
- fprintf (dump_file, " [%i]\n", bb->frequency);
}
}
@@ -4906,7 +4908,6 @@ rtl_flow_call_edges_add (sbitmap blocks)
edge ne = make_edge (bb, EXIT_BLOCK_PTR_FOR_FN (cfun), EDGE_FAKE);
ne->probability = profile_probability::guessed_never ();
- ne->count = profile_count::guessed_zero ();
}
if (insn == BB_HEAD (bb))
@@ -5045,7 +5046,7 @@ rtl_account_profile_record (basic_block bb, int after_pass,
+= insn_cost (insn, true) * bb->count.to_gcov_type ();
else if (profile_status_for_fn (cfun) == PROFILE_GUESSED)
record->time[after_pass]
- += insn_cost (insn, true) * bb->frequency;
+ += insn_cost (insn, true) * bb->count.to_frequency (cfun);
}
}