summaryrefslogtreecommitdiff
path: root/gcc/profile.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-25 23:21:07 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-25 23:21:07 +0000
commit060813d5b19953d9b3d9536e1e064c5e503eee59 (patch)
tree4392e10fd036d9f719e777e135df217f0ac7eee9 /gcc/profile.c
parent4896f367c37bd03e7a6f02b55575ff1e35d9c58c (diff)
downloadgcc-060813d5b19953d9b3d9536e1e064c5e503eee59.tar.gz
* profile.c (compute_branch_probabilities): Use REG_BR_PROB notes
when re-constructing profile previously invalidated by loop. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88115 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/profile.c')
-rw-r--r--gcc/profile.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gcc/profile.c b/gcc/profile.c
index 3f48be623d2..39d0493c6dd 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -557,12 +557,24 @@ compute_branch_probabilities (void)
num_branches++;
}
}
- /* Otherwise distribute the probabilities evenly so we get sane
- sum. Use simple heuristics that if there are normal edges,
+ /* Otherwise try to preserve the existing REG_BR_PROB probabilities
+ tree based profile guessing put into code. */
+ else if (profile_status == PROFILE_ABSENT
+ && !ir_type ()
+ && bb->succ && bb->succ->succ_next
+ && (note = find_reg_note (BB_END (bb), REG_BR_PROB, 0)))
+ {
+ int prob = INTVAL (XEXP (note, 0));
+
+ BRANCH_EDGE (bb)->probability = prob;
+ FALLTHRU_EDGE (bb)->probability = REG_BR_PROB_BASE - prob;
+ }
+ /* As a last resolt, distribute the probabilities evenly.
+ Use simple heuristics that if there are normal edges,
give all abnormals frequency of 0, otherwise distribute the
frequency over abnormals (this is the case of noreturn
calls). */
- else
+ else if (profile_status == PROFILE_ABSENT)
{
int total = 0;