diff mbox series

Fix profile update when producing inline clone

Message ID 20171123160237.GA71650@kam.mff.cuni.cz
State New
Headers show
Series Fix profile update when producing inline clone | expand

Commit Message

Jan Hubicka Nov. 23, 2017, 4:02 p.m. UTC
Hi,
while updating cgraph_node::create_clone I forgot that it also is used to create
inline clones.  In that case we can not preserve original local count even if
prof_count is 0.

Bootstrapped/regtested x86_64-linux, comitted.

Honza

	* cgraphclones.c (cgraph_node::create_clone): Fix updating of profile
	when inlining.
diff mbox series

Patch

Index: cgraphclones.c
===================================================================
--- cgraphclones.c	(revision 255053)
+++ cgraphclones.c	(working copy)
@@ -428,7 +428,10 @@  cgraph_node::create_clone (tree new_decl
   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.  */