diff options
author | Teresa Johnson <tejohnson@google.com> | 2013-04-08 17:39:10 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@gcc.gnu.org> | 2013-04-08 17:39:10 +0000 |
commit | 8ddb5a296eea999c6376f43a643b2baf79cf886a (patch) | |
tree | ffb943825496db918422c6ebe357dcdcc5207a4b /gcc/ipa-inline-analysis.c | |
parent | d6222d4ef011f80c08fb9619c29619b47daf4feb (diff) | |
download | gcc-8ddb5a296eea999c6376f43a643b2baf79cf886a.zip gcc-8ddb5a296eea999c6376f43a643b2baf79cf886a.tar.gz gcc-8ddb5a296eea999c6376f43a643b2baf79cf886a.tar.bz2 |
First phase of unifying the computation of profile scale factors/probabilities and the actual scaling to use rounding divides...
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.
From-SVN: r197595
Diffstat (limited to 'gcc/ipa-inline-analysis.c')
-rw-r--r-- | gcc/ipa-inline-analysis.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 5343933..138433c 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -2093,8 +2093,7 @@ param_change_prob (gimple stmt, int i) if (!init_freq) init_freq = 1; if (init_freq < bb->frequency) - return MAX ((init_freq * REG_BR_PROB_BASE + - bb->frequency / 2) / bb->frequency, 1); + return MAX (GCOV_COMPUTE_SCALE (init_freq, bb->frequency), 1); else return REG_BR_PROB_BASE; } @@ -2136,8 +2135,7 @@ param_change_prob (gimple stmt, int i) BITMAP_FREE (info.bb_set); if (max < bb->frequency) - return MAX ((max * REG_BR_PROB_BASE + - bb->frequency / 2) / bb->frequency, 1); + return MAX (GCOV_COMPUTE_SCALE (max, bb->frequency), 1); else return REG_BR_PROB_BASE; } @@ -2792,6 +2790,7 @@ estimate_edge_size_and_time (struct cgraph_edge *e, int *size, int *time, && hints && cgraph_maybe_hot_edge_p (e)) *hints |= INLINE_HINT_indirect_call; *size += call_size * INLINE_SIZE_SCALE; + /* Update to use apply_probability(). */ *time += call_time * prob / REG_BR_PROB_BASE * e->frequency * (INLINE_TIME_SCALE / CGRAPH_FREQ_BASE); if (*time > MAX_TIME * INLINE_TIME_SCALE) @@ -2902,6 +2901,7 @@ estimate_node_size_and_time (struct cgraph_node *node, inline_param_summary); gcc_checking_assert (prob >= 0); gcc_checking_assert (prob <= REG_BR_PROB_BASE); + /* Update to use apply_probability(). */ time += ((gcov_type) e->time * prob) / REG_BR_PROB_BASE; } if (time > MAX_TIME * INLINE_TIME_SCALE) @@ -3120,8 +3120,7 @@ remap_edge_change_prob (struct cgraph_edge *inlined_edge, int jf_formal_id = ipa_get_jf_pass_through_formal_id (jfunc); int prob1 = es->param[i].change_prob; int prob2 = inlined_es->param[jf_formal_id].change_prob; - int prob = ((prob1 * prob2 + REG_BR_PROB_BASE / 2) - / REG_BR_PROB_BASE); + int prob = combine_probabilities (prob1, prob2); if (prob1 && prob2 && !prob) prob = 1; @@ -3312,6 +3311,7 @@ inline_merge_summary (struct cgraph_edge *edge) int prob = predicate_probability (callee_info->conds, &e->predicate, clause, es->param); + /* Update to use apply_probability(). */ add_time = ((gcov_type) add_time * prob) / REG_BR_PROB_BASE; if (add_time > MAX_TIME * INLINE_TIME_SCALE) add_time = MAX_TIME * INLINE_TIME_SCALE; |