aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2015-10-12 08:08:06 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2015-10-12 06:08:06 +0000
commit5330a79d3409f2e0f0dfd314414e53e29136cf89 (patch)
treed4accf58de2a34e8123d341b92a7158299ca171e /gcc
parent86b7136a66a19238434916c6a6f5e9fe1c4ad54e (diff)
downloadgcc-5330a79d3409f2e0f0dfd314414e53e29136cf89.zip
gcc-5330a79d3409f2e0f0dfd314414e53e29136cf89.tar.gz
gcc-5330a79d3409f2e0f0dfd314414e53e29136cf89.tar.bz2
cgraphbuild.c (compute_call_stmt_bb_frequency): Use counts when these are more informative.
* cgraphbuild.c (compute_call_stmt_bb_frequency): Use counts when these are more informative. From-SVN: r228703
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/cgraphbuild.c16
2 files changed, 16 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 931dede..5d38bf6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2015-10-11 Jan Hubicka <hubicka@ucw.cz>
+ * cgraphbuild.c (compute_call_stmt_bb_frequency): Use
+ counts when these are more informative.
+
+2015-10-11 Jan Hubicka <hubicka@ucw.cz>
+
* tree-profile.c (tree_profiling): Do not clear
pure/const when not instrumenting.
(pass tree_profile): Add dump of symtab.
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index 33b01be..a7b4af6 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;