aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2013-04-08 17:39:10 +0000
committerTeresa Johnson <tejohnson@gcc.gnu.org>2013-04-08 17:39:10 +0000
commit8ddb5a296eea999c6376f43a643b2baf79cf886a (patch)
treeffb943825496db918422c6ebe357dcdcc5207a4b /gcc/tree-inline.c
parentd6222d4ef011f80c08fb9619c29619b47daf4feb (diff)
downloadgcc-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/tree-inline.c')
-rw-r--r--gcc/tree-inline.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index a41dd5a..978db6e 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1521,10 +1521,12 @@ 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(). */
copy_basic_block->count = bb->count * count_scale / REG_BR_PROB_BASE;
/* We are going to rebuild frequencies from scratch. These values
have just small importance to drive canonicalize_loop_headers. */
+ /* Update to use EDGE_FREQUENCY. */
freq = ((gcov_type)bb->frequency * frequency_scale / REG_BR_PROB_BASE);
/* We recompute frequencies after inlining, so this is quite safe. */
@@ -1890,6 +1892,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(). */
new_edge->count = old_edge->count * count_scale / REG_BR_PROB_BASE;
new_edge->probability = old_edge->probability;
}
@@ -2060,6 +2063,7 @@ initialize_cfun (tree new_fndecl, tree callee_fndecl, gcov_type count)
struct function *src_cfun = DECL_STRUCT_FUNCTION (callee_fndecl);
gcov_type count_scale;
+ /* Update to use GCOV_COMPUTE_SCALE. */
if (ENTRY_BLOCK_PTR_FOR_FUNCTION (src_cfun)->count)
count_scale = (REG_BR_PROB_BASE * count
/ ENTRY_BLOCK_PTR_FOR_FUNCTION (src_cfun)->count);
@@ -2207,6 +2211,7 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
int incoming_frequency = 0;
gcov_type incoming_count = 0;
+ /* Update to use GCOV_COMPUTE_SCALE. */
if (ENTRY_BLOCK_PTR_FOR_FUNCTION (src_cfun)->count)
count_scale = (REG_BR_PROB_BASE * count
/ ENTRY_BLOCK_PTR_FOR_FUNCTION (src_cfun)->count);
@@ -2231,7 +2236,9 @@ 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(). */
incoming_count = incoming_count * count_scale / REG_BR_PROB_BASE;
+ /* Update to use EDGE_FREQUENCY. */
incoming_frequency
= incoming_frequency * frequency_scale / REG_BR_PROB_BASE;
ENTRY_BLOCK_PTR->count = incoming_count;
@@ -4051,6 +4058,7 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
a self-referential call; if we're calling ourselves, we need to
duplicate our body before altering anything. */
copy_body (id, bb->count,
+ /* Update to use GCOV_COMPUTE_SCALE. */
cg_edge->frequency * REG_BR_PROB_BASE / CGRAPH_FREQ_BASE,
bb, return_block, NULL, NULL);