Is this patch ok for trunk? Bootstrapped and regression test on-going. Thanks, Dehao
2014-05-16 Dehao Chen <de...@google.com> * tree-inline.c (initialize_cfun): Ensure count_scale is no larger than REG_BR_PROB_BASE. (copy_cfg_body): Likewise. Index: gcc/tree-inline.c =================================================================== --- gcc/tree-inline.c (revision 210535) +++ gcc/tree-inline.c (working copy) @@ -2190,7 +2190,8 @@ initialize_cfun (tree new_fndecl, tree callee_fnde if (!DECL_RESULT (new_fndecl)) DECL_RESULT (new_fndecl) = DECL_RESULT (callee_fndecl); - if (ENTRY_BLOCK_PTR_FOR_FN (src_cfun)->count) + if (ENTRY_BLOCK_PTR_FOR_FN (src_cfun)->count + && count < ENTRY_BLOCK_PTR_FOR_FN (src_cfun)->count) count_scale = GCOV_COMPUTE_SCALE (count, ENTRY_BLOCK_PTR_FOR_FN (src_cfun)->count); @@ -2451,7 +2452,8 @@ copy_cfg_body (copy_body_data * id, gcov_type coun freqs_to_counts (id->src_node, count > in_count ? count : in_count); } - if (ENTRY_BLOCK_PTR_FOR_FN (src_cfun)->count) + if (ENTRY_BLOCK_PTR_FOR_FN (src_cfun)->count + && count < ENTRY_BLOCK_PTR_FOR_FN (src_cfun)->count) count_scale = GCOV_COMPUTE_SCALE (count, ENTRY_BLOCK_PTR_FOR_FN (src_cfun)->count);