aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2013-04-29 13:22:46 +0000
committerTeresa Johnson <tejohnson@gcc.gnu.org>2013-04-29 13:22:46 +0000
commitf41f80f90846d26a89ed5a6440bc283b745235ac (patch)
tree9daf54908866e15052bfcfc011bc4753b4b363fb /gcc/tree-inline.c
parent315bbd2e3c15dea3528259be2aee2876dec33843 (diff)
downloadgcc-f41f80f90846d26a89ed5a6440bc283b745235ac.zip
gcc-f41f80f90846d26a89ed5a6440bc283b745235ac.tar.gz
gcc-f41f80f90846d26a89ed5a6440bc283b745235ac.tar.bz2
This patch fixes PR bootstrap/57077.
This patch fixes PR bootstrap/57077. Certain new uses of apply_probability are actually scaling the counts up, and the scale factor should not be treated as a probability as the value may exceed REG_BR_PROB_BASE. One example (from the PR) is when scaling counts up in LTO when merging profiles. Another example I found when preparing the patch to use the rounding divide in more places is when inlining COMDAT functions. Add new helper function apply_scale that does the scaling without the probability range check. I audited the new uses of apply_probability and changed the calls as appropriate. 2013-04-29 Teresa Johnson <tejohnson@google.com> PR bootstrap/57077 * basic-block.h (apply_scale): New function. (apply_probability): Use apply_scale. * gimple-streamer-in.c (input_bb): Ditto. * lto-streamer-in.c (input_cfg): Ditto. * lto-cgraph.c (merge_profile_summaries): Ditto. * tree-optimize.c (execute_fixup_cfg): Ditto. * tree-inline.c (copy_bb): Update comment to use apply_scale. (copy_edges_for_bb): Ditto. (copy_cfg_body): Ditto. From-SVN: r198416
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index c358cbe..69455ce 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1519,7 +1519,7 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
basic_block_info automatically. */
copy_basic_block = create_basic_block (NULL, (void *) 0,
(basic_block) prev->aux);
- /* Update to use apply_probability(). */
+ /* Update to use apply_scale(). */
copy_basic_block->count = bb->count * count_scale / REG_BR_PROB_BASE;
/* We are going to rebuild frequencies from scratch. These values
@@ -1891,7 +1891,7 @@ copy_edges_for_bb (basic_block bb, gcov_type count_scale, basic_block ret_bb,
&& old_edge->dest->aux != EXIT_BLOCK_PTR)
flags |= EDGE_FALLTHRU;
new_edge = make_edge (new_bb, (basic_block) old_edge->dest->aux, flags);
- /* Update to use apply_probability(). */
+ /* Update to use apply_scale(). */
new_edge->count = old_edge->count * count_scale / REG_BR_PROB_BASE;
new_edge->probability = old_edge->probability;
}
@@ -2278,7 +2278,7 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
incoming_frequency += EDGE_FREQUENCY (e);
incoming_count += e->count;
}
- /* Update to use apply_probability(). */
+ /* Update to use apply_scale(). */
incoming_count = incoming_count * count_scale / REG_BR_PROB_BASE;
/* Update to use EDGE_FREQUENCY. */
incoming_frequency