summaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorspark <spark@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-18 19:02:44 +0000
committerspark <spark@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-18 19:02:44 +0000
commite0dc6f2bee436056af7d1c49ed2714fa53ee430d (patch)
tree60eb8bcbffe0c58454ecbc0a68eeff80b6a19db3 /gcc/cgraph.c
parent826174ed5baf39165e89813106f5df7bc36021c7 (diff)
downloadgcc-e0dc6f2bee436056af7d1c49ed2714fa53ee430d.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139208 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 37ad9f1606f..a8463d40368 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)