aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgbuild.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cfgbuild.c')
-rw-r--r--gcc/cfgbuild.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index 07ef949d2..6e5c6ef75 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -559,16 +559,35 @@ compute_outgoing_frequencies (basic_block b)
f->count = b->count - e->count;
return;
}
+ else
+ {
+ guess_outgoing_edge_probabilities (b);
+ }
}
-
- if (single_succ_p (b))
+ else if (single_succ_p (b))
{
e = single_succ_edge (b);
e->probability = REG_BR_PROB_BASE;
e->count = b->count;
return;
}
- guess_outgoing_edge_probabilities (b);
+ else
+ {
+ /* We rely on BBs with more than two successors to have sane probabilities
+ and do not guess them here. For BBs terminated by switch statements
+ expanded to jump-table jump, we have done the right thing during
+ expansion. For EH edges, we still guess the probabilities here. */
+ bool complex_edge = false;
+ FOR_EACH_EDGE (e, ei, b->succs)
+ if (e->flags & EDGE_COMPLEX)
+ {
+ complex_edge = true;
+ break;
+ }
+ if (complex_edge)
+ guess_outgoing_edge_probabilities (b);
+ }
+
if (b->count)
FOR_EACH_EDGE (e, ei, b->succs)
e->count = ((b->count * e->probability + REG_BR_PROB_BASE / 2)