aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-optimize.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-optimize.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-optimize.c')
-rw-r--r--gcc/tree-optimize.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c
index d399d8a..0948d2e 100644
--- a/gcc/tree-optimize.c
+++ b/gcc/tree-optimize.c
@@ -131,15 +131,15 @@ execute_fixup_cfg (void)
ENTRY_BLOCK_PTR->count);
ENTRY_BLOCK_PTR->count = cgraph_get_node (current_function_decl)->count;
- EXIT_BLOCK_PTR->count = apply_probability (EXIT_BLOCK_PTR->count,
- count_scale);
+ EXIT_BLOCK_PTR->count = apply_scale (EXIT_BLOCK_PTR->count,
+ count_scale);
FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR->succs)
- e->count = apply_probability (e->count, count_scale);
+ e->count = apply_scale (e->count, count_scale);
FOR_EACH_BB (bb)
{
- bb->count = apply_probability (bb->count, count_scale);
+ bb->count = apply_scale (bb->count, count_scale);
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
@@ -172,7 +172,7 @@ execute_fixup_cfg (void)
}
FOR_EACH_EDGE (e, ei, bb->succs)
- e->count = apply_probability (e->count, count_scale);
+ e->count = apply_scale (e->count, count_scale);
/* If we have a basic block with no successors that does not
end with a control statement or a noreturn call end it with