summaryrefslogtreecommitdiff
path: root/gcc/ipa-cp.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2019-12-05 19:12:51 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2019-12-05 18:12:51 +0000
commit34fbe3f0946f88828765184ed6581bda62cdf49f (patch)
tree5a3bf82ae6bb92203c6e4922a5d694198595edc6 /gcc/ipa-cp.c
parent8575d5925226a8f92ee644d6d59a2b1b93840d94 (diff)
cgraphclones.c (localize_profile): New function.
* cgraphclones.c (localize_profile): New function. (cgraph_node::create_clone): Use it for partial profiles. * common.opt (fprofile-partial-training): New flag. * doc/invoke.texi (-fprofile-partial-training): Document. * ipa-cp.c (update_profiling_info): For partial profiles do not set function profile to zero. * profile.c (compute_branch_probabilities): With partial profile watch if edge count is zero and turn all probabilities to guessed. (compute_branch_probabilities): For partial profiles do not apply profile when entry count is zero. * tree-profile.c (tree_profiling): Only do value_profile_transformations when profile is read. From-SVN: r279013
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r--gcc/ipa-cp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 693c7a2fdc5..14064ae0034 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -4295,6 +4295,15 @@ update_profiling_info (struct cgraph_node *orig_node,
remainder = orig_node_count.combine_with_ipa_count (orig_node_count.ipa ()
- new_sum.ipa ());
+
+ /* With partial train run we do not want to assume that original's
+ count is zero whenever we redurect all executed edges to clone.
+ Simply drop profile to local one in this case. */
+ if (remainder.ipa_p () && !remainder.ipa ().nonzero_p ()
+ && orig_node->count.ipa_p () && orig_node->count.ipa ().nonzero_p ()
+ && flag_profile_partial_training)
+ remainder = remainder.guessed_local ();
+
new_sum = orig_node_count.combine_with_ipa_count (new_sum);
new_node->count = new_sum;
orig_node->count = remainder;