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. 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. */