aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-threadupdate.c
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2014-10-03 00:46:16 +0000
committerTeresa Johnson <tejohnson@gcc.gnu.org>2014-10-03 00:46:16 +0000
commit5d20321177a3ef53a7051e5d7e97d2e89573f2bc (patch)
tree0430a18ccb1596178f9ace30bea1669a04f552e1 /gcc/tree-ssa-threadupdate.c
parenta3f5573622df0409c8afd9e77d9a438e46d1d937 (diff)
downloadgcc-5d20321177a3ef53a7051e5d7e97d2e89573f2bc.zip
gcc-5d20321177a3ef53a7051e5d7e97d2e89573f2bc.tar.gz
gcc-5d20321177a3ef53a7051e5d7e97d2e89573f2bc.tar.bz2
tree-ssa-threadupdate.c (freqs_to_counts_path): Scale frequencies up when synthesizing counts to avoid rounding errors.
2014-10-02 Teresa Johnson <tejohnson@google.com> * tree-ssa-threadupdate.c (freqs_to_counts_path): Scale frequencies up when synthesizing counts to avoid rounding errors. From-SVN: r215830
Diffstat (limited to 'gcc/tree-ssa-threadupdate.c')
-rw-r--r--gcc/tree-ssa-threadupdate.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index e3e77cf..d660fdb 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -977,15 +977,25 @@ freqs_to_counts_path (struct redirection_data *rd)
edge ein;
edge_iterator ei;
FOR_EACH_EDGE (ein, ei, e->dest->preds)
- ein->count = EDGE_FREQUENCY (ein);
+ {
+ /* Scale up the frequency by REG_BR_PROB_BASE, to avoid rounding
+ errors applying the probability when the frequencies are very
+ small. */
+ ein->count = apply_probability (ein->src->frequency * REG_BR_PROB_BASE,
+ ein->probability);
+ }
for (unsigned int i = 1; i < path->length (); i++)
{
edge epath = (*path)[i]->e;
edge esucc;
+ /* Scale up the frequency by REG_BR_PROB_BASE, to avoid rounding
+ errors applying the edge probability when the frequencies are very
+ small. */
+ epath->src->count = epath->src->frequency * REG_BR_PROB_BASE;
FOR_EACH_EDGE (esucc, ei, epath->src->succs)
- esucc->count = EDGE_FREQUENCY (esucc);
- epath->src->count = epath->src->frequency;
+ esucc->count = apply_probability (esucc->src->count,
+ esucc->probability);
}
}