From 8f58dbd171388efd96d61408a1de7b99bd95f627 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 23 Nov 2017 16:52:50 +0100 Subject: [PATCH] cgraphclones.c (cgraph_node::create_clone): Fix updating of profile when inlining. * cgraphclones.c (cgraph_node::create_clone): Fix updating of profile when inlining. From-SVN: r255102 --- gcc/ChangeLog | 5 +++++ gcc/cgraphclones.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 39486ff2612..1ac0ef029a8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-11-23 Jan Hubicka + + * cgraphclones.c (cgraph_node::create_clone): Fix updating of profile + when inlining. + 2017-11-23 Tom de Vries * config/sh/sh.h (ASM_OUTPUT_ADDR_VEC_ELT): Wrap in "do {} while (0)". diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c index ef39d85e88c..0e7e35bbc44 100644 --- a/gcc/cgraphclones.c +++ b/gcc/cgraphclones.c @@ -428,7 +428,10 @@ cgraph_node::create_clone (tree new_decl, profile_count prof_count, if (new_inlined_to) dump_callgraph_transformation (this, new_inlined_to, "inlining to"); - prof_count = count.combine_with_ipa_count (prof_count); + /* When inlining we scale precisely to prof_count, when cloning we can + preserve local profile. */ + if (!new_inlined_to) + prof_count = count.combine_with_ipa_count (prof_count); new_node->count = prof_count; /* Update IPA profile. Local profiles need no updating in original. */ -- 2.30.2