diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-10-12 06:08:06 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-10-12 06:08:06 +0000 |
commit | b5f3ba2abffe26ee15d3a6a1f511166f8b4571eb (patch) | |
tree | d4accf58de2a34e8123d341b92a7158299ca171e /gcc/cgraphbuild.c | |
parent | 1059fe8616747dba3d278a7ce58bf0ca38fe87a5 (diff) | |
download | gcc-b5f3ba2abffe26ee15d3a6a1f511166f8b4571eb.tar.gz |
* cgraphbuild.c (compute_call_stmt_bb_frequency): Use
counts when these are more informative.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228703 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraphbuild.c')
-rw-r--r-- | gcc/cgraphbuild.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index 33b01be83ac..a7b4af6d9fb 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -202,15 +202,21 @@ compute_call_stmt_bb_frequency (tree decl, basic_block bb) { int entry_freq = ENTRY_BLOCK_PTR_FOR_FN (DECL_STRUCT_FUNCTION (decl))->frequency; - int freq = bb->frequency; + gcov_type entry_count = ENTRY_BLOCK_PTR_FOR_FN + (DECL_STRUCT_FUNCTION (decl))->count; + gcov_type freq = bb->frequency; if (profile_status_for_fn (DECL_STRUCT_FUNCTION (decl)) == PROFILE_ABSENT) return CGRAPH_FREQ_BASE; - if (!entry_freq) - entry_freq = 1, freq++; - - freq = freq * CGRAPH_FREQ_BASE / entry_freq; + if (entry_count > entry_freq) + freq = RDIV (bb->count * CGRAPH_FREQ_BASE, entry_count); + else + { + if (!entry_freq) + entry_freq = 1, freq++; + freq = RDIV (freq * CGRAPH_FREQ_BASE, entry_freq); + } if (freq > CGRAPH_FREQ_MAX) freq = CGRAPH_FREQ_MAX; |