summaryrefslogtreecommitdiff
path: root/gcc/cfgbuild.c
diff options
context:
space:
mode:
authortejohnson <tejohnson@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-08 17:39:10 +0000
committertejohnson <tejohnson@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-08 17:39:10 +0000
commitf9d4b7f4943df04e4362f7cde1fb6c6de22283ef (patch)
treeffb943825496db918422c6ebe357dcdcc5207a4b /gcc/cfgbuild.c
parent3f4737cd41c1ae5451f9bd34414d33b3214d6dec (diff)
downloadgcc-f9d4b7f4943df04e4362f7cde1fb6c6de22283ef.tar.gz
First phase of unifying the computation of profile scale factors/probabilities
and the actual scaling to use rounding divides: - Add new macro GCOV_COMPUTE_SCALE to basic-block.h to compute the scale factor/probability via a rounding divide. - Change all locations that already perform rounding divides (inline or via RDIV) to use the appropriate helper: GCOV_COMPUTE_SCALE, apply_probability or combine_probabilities. - Change ipa-cp.c truncating divides to use rounding divides. - Add comments to all other locations (currently using truncating divides) to switch them to one of the helpers so they use a rounding divide. Next phase will be to replace the locations using truncating divides, marked with a comment here, into rounding divides via the helper methods. 2013-04-08 Teresa Johnson <tejohnson@google.com> * basic-block.h (GCOV_COMPUTE_SCALE): Define. * ipa-inline-analysis.c (param_change_prob): Use helper rounding divide methods. (estimate_edge_size_and_time): Add comment to suggest using rounding methods. (estimate_node_size_and_time): Ditto. (remap_edge_change_prob): Use helper rounding divide methods. * value-prof.c (gimple_divmod_fixed_value_transform): Ditto. (gimple_mod_pow2_value_transform): Ditto. (gimple_mod_subtract_transform): Ditto. (gimple_ic_transform): Ditto. (gimple_stringops_transform): Ditto. * stmt.c (conditional_probability): Ditto. (emit_case_dispatch_table): Ditto. * lto-cgraph.c (merge_profile_summaries): Ditto. * tree-optimize.c (execute_fixup_cfg): Ditto. * cfgcleanup.c (try_forward_edges): Ditto. * cfgloopmanip.c (scale_loop_profile): Ditto. (loopify): Ditto. (duplicate_loop_to_header_edge): Ditto. (lv_adjust_loop_entry_edge): Ditto. * tree-vect-loop.c (vect_transform_loop): Ditto. * profile.c (compute_branch_probabilities): Ditto. * cfgbuild.c (compute_outgoing_frequencies): Ditto. * lto-streamer-in.c (input_cfg): Ditto. * gimple-streamer-in.c (input_bb): Ditto. * ipa-cp.c (update_profiling_info): Ditto. (update_specialized_profile): Ditto. * tree-vect-loop-manip.c (slpeel_tree_peel_loop_to_edge): Ditto. * cfg.c (update_bb_profile_for_threading): Add comment to suggest using rounding methods. * sched-rgn.c (compute_dom_prob_ps): Ditto. (compute_trg_info): Ditto. * cfgrtl.c (force_nonfallthru_and_redirect): Ditto. (purge_dead_edges): Ditto. * loop-unswitch.c (unswitch_loop): Ditto. * cgraphclones.c (cgraph_clone_edge): Ditto. (cgraph_clone_node): Ditto. * tree-inline.c (copy_bb): Ditto. (copy_edges_for_bb): Ditto. (initialize_cfun): Ditto. (copy_cfg_body): Ditto. (expand_call_inline): Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197595 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgbuild.c')
-rw-r--r--gcc/cfgbuild.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index 1e0121dbc02..ac6aefb86df 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -545,8 +545,7 @@ compute_outgoing_frequencies (basic_block b)
probability = INTVAL (XEXP (note, 0));
e = BRANCH_EDGE (b);
e->probability = probability;
- e->count = ((b->count * probability + REG_BR_PROB_BASE / 2)
- / REG_BR_PROB_BASE);
+ e->count = apply_probability (b->count, probability);
f = FALLTHRU_EDGE (b);
f->probability = REG_BR_PROB_BASE - probability;
f->count = b->count - e->count;
@@ -583,8 +582,7 @@ compute_outgoing_frequencies (basic_block b)
if (b->count)
FOR_EACH_EDGE (e, ei, b->succs)
- e->count = ((b->count * e->probability + REG_BR_PROB_BASE / 2)
- / REG_BR_PROB_BASE);
+ e->count = apply_probability (b->count, e->probability);
}
/* Assume that some pass has inserted labels or control flow