diff options
author | Paul Yuan <yingbo.com@gmail.com> | 2008-08-18 19:02:44 +0000 |
---|---|---|
committer | Seongbae Park <spark@gcc.gnu.org> | 2008-08-18 19:02:44 +0000 |
commit | 52c76998c7109adca55106b881b9945fea860015 (patch) | |
tree | 60eb8bcbffe0c58454ecbc0a68eeff80b6a19db3 /gcc/cgraph.c | |
parent | 808cc41726a4f1b3ab1b87521e086baf3de66432 (diff) | |
download | gcc-52c76998c7109adca55106b881b9945fea860015.zip gcc-52c76998c7109adca55106b881b9945fea860015.tar.gz gcc-52c76998c7109adca55106b881b9945fea860015.tar.bz2 |
cgraph.c (cgraph_edge): Handle inconsistent counts when setting count_scale.
2008-08-18 Paul Yuan <yingbo.com@gmail.com>
Vinodha Ramasamy <vinodha@google.com>
* cgraph.c (cgraph_edge): Handle inconsistent counts when setting
count_scale.
* value-prof.c (check_counter): Fix the counter if
flag_profile_correction is true.
(tree_divmod_fixed_value_transform, tree_mod_pow2_value_transform,
tree_mod_subtract_transform):
Follow check_counter parameter change.
* common.opt (fprofile-correction): New option.
* mcf.c: New file.
* profile.c (edge_info, EDGE_INFO): Moved to new file profile.h.
(sum_edge_counts, is_edge_inconsistent, correct_negative_edge_counts,
is_inconsistent, set_bb_counts, read_profile_edge_counts): New
functions.
(compute_branch_probabilities): Refactored. Invokes mcf_smooth_cfg if
flag_profile_correction is set.
Co-Authored-By: Vinodha Ramasamy <vinodha@google.com>
From-SVN: r139208
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 37ad9f1..a8463d4 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -516,7 +516,7 @@ cgraph_edge (struct cgraph_node *node, gimple call_stmt) if (node->call_site_hash) return (struct cgraph_edge *) htab_find_with_hash (node->call_site_hash, call_stmt, - htab_hash_pointer (call_stmt)); + htab_hash_pointer (call_stmt)); /* This loop may turn out to be performance problem. In such case adding hashtables into call nodes with very many edges is probably best @@ -1208,7 +1208,12 @@ cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq, new_node->master_clone = n->master_clone; new_node->count = count; if (n->count) - count_scale = new_node->count * REG_BR_PROB_BASE / n->count; + { + if (new_node->count > n->count) + count_scale = REG_BR_PROB_BASE; + else + count_scale = new_node->count * REG_BR_PROB_BASE / n->count; + } else count_scale = 0; if (update_original) |