From 5db0241f0c3d3130a502d9c6a59713302a1377bf Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sun, 26 Sep 2004 01:21:07 +0200 Subject: [PATCH] profile.c (compute_branch_probabilities): Use REG_BR_PROB notes when re-constructing profile previously invalidated by loop. * profile.c (compute_branch_probabilities): Use REG_BR_PROB notes when re-constructing profile previously invalidated by loop. From-SVN: r88115 --- gcc/ChangeLog | 5 +++++ gcc/profile.c | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0ba761ff869..7cd05ada747 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-09-26 Jan Hubicka + + * profile.c (compute_branch_probabilities): Use REG_BR_PROB notes + when re-constructing profile previously invalidated by loop. + 2004-09-25 Dale Johannesen * tree-gimple.c: Move GIMPLE definition... 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; -- 2.30.2