Commit 5d203211 by Teresa Johnson Committed by Teresa Johnson

tree-ssa-threadupdate.c (freqs_to_counts_path): Scale frequencies up when…

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
parent a3f55736
2014-10-02 Teresa Johnson <tejohnson@google.com> 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.
2014-10-02 Teresa Johnson <tejohnson@google.com>
PR middle-end/63422 PR middle-end/63422
* tree-ssa-threadupdate.c (freqs_to_counts_path): Remove * tree-ssa-threadupdate.c (freqs_to_counts_path): Remove
asserts to handle incoming insanities. asserts to handle incoming insanities.
...@@ -977,15 +977,25 @@ freqs_to_counts_path (struct redirection_data *rd) ...@@ -977,15 +977,25 @@ freqs_to_counts_path (struct redirection_data *rd)
edge ein; edge ein;
edge_iterator ei; edge_iterator ei;
FOR_EACH_EDGE (ein, ei, e->dest->preds) 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++) for (unsigned int i = 1; i < path->length (); i++)
{ {
edge epath = (*path)[i]->e; edge epath = (*path)[i]->e;
edge esucc; 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) FOR_EACH_EDGE (esucc, ei, epath->src->succs)
esucc->count = EDGE_FREQUENCY (esucc); esucc->count = apply_probability (esucc->src->count,
epath->src->count = epath->src->frequency; esucc->probability);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment