cgraphclones.c (cgraph_node::create_clone): Fix updating of profile when inlining.
authorJan Hubicka <hubicka@ucw.cz>
Thu, 23 Nov 2017 15:52:50 +0000 (16:52 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 23 Nov 2017 15:52:50 +0000 (15:52 +0000)
* cgraphclones.c (cgraph_node::create_clone): Fix updating of profile
when inlining.

From-SVN: r255102

gcc/ChangeLog
gcc/cgraphclones.c

index 39486ff2612427e76a5e72766e1f2b2f03072a7e..1ac0ef029a82def394fdf22219588fcc72c9617c 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-23  Jan Hubicka  <hubicka@ucw.cz>
+
+       * cgraphclones.c (cgraph_node::create_clone): Fix updating of profile
+       when inlining.
+
 2017-11-23  Tom de Vries  <tom@codesourcery.com>
 
        * config/sh/sh.h (ASM_OUTPUT_ADDR_VEC_ELT): Wrap in "do {} while (0)".
index ef39d85e88c1acd88318e345259cdccc01d43c3a..0e7e35bbc44ed9db7270a5301f155c862e385b50 100644 (file)
@@ -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.  */