aboutsummaryrefslogtreecommitdiff
path: root/gcc/predict.c
diff options
context:
space:
mode:
authorMartin Liska <marxin.liska@gmail.com>2013-12-17 22:20:12 +0000
committerMartin Liska <marxin@gcc.gnu.org>2013-12-17 22:20:12 +0000
commit9cec31f43afbdb326fddbc144e9aea63986828e4 (patch)
tree3ad29a01dabd9e49f49f9ebdc04f7655721d6300 /gcc/predict.c
parent14407011d62da724e88ac0cb30390d3f8fda2b9f (diff)
downloadgcc-9cec31f43afbdb326fddbc144e9aea63986828e4.zip
gcc-9cec31f43afbdb326fddbc144e9aea63986828e4.tar.gz
gcc-9cec31f43afbdb326fddbc144e9aea63986828e4.tar.bz2
Time profile-based function reordering (phase 2).
Co-Authored-By: Jan Hubicka <jh@suse.cz> From-SVN: r206070
Diffstat (limited to 'gcc/predict.c')
-rw-r--r--gcc/predict.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/predict.c b/gcc/predict.c
index a5ad34f..1826a06 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -2839,12 +2839,24 @@ handle_missing_profiles (void)
{
struct cgraph_edge *e;
gcov_type call_count = 0;
+ gcov_type max_tp_first_run = 0;
struct function *fn = DECL_STRUCT_FUNCTION (node->decl);
if (node->count)
continue;
for (e = node->callers; e; e = e->next_caller)
+ {
call_count += e->count;
+
+ if (e->caller->tp_first_run > max_tp_first_run)
+ max_tp_first_run = e->caller->tp_first_run;
+ }
+
+ /* If time profile is missing, let assign the maximum that comes from
+ caller functions. */
+ if (!node->tp_first_run && max_tp_first_run)
+ node->tp_first_run = max_tp_first_run + 1;
+
if (call_count
&& fn && fn->cfg
&& (call_count * unlikely_count_fraction >= profile_info->runs))