Fix profile adjusments while cloning
This patch fixes profile updates while cloning. When new clone is produced
its global profile is subtracted from the original function. If the original
function profile drops to 0 we want to switch from global profiles to global0
profiles which is implemented by combine_with_ipa_count_within.
However this is done on all edges independnetly and it may happen that we end
up combining global and globa0 profiles in one functions which is not a good
idea.
This implements profile_count::combine_with_ipa_count_within which is able
to take into account that the counter is inside function with a given count.
* profile-count.h (profile_count::combine_with_ipa_count_within):
Declare.
* profile-count.c (profile_count::combine_with_ipa_count_within):
New.
* cgraphclones.c (cgraph_edge::clone, cgraph_node::create_clone): Use
it.
From-SVN: r278810