diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2018-12-24 02:37:44 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2018-12-24 01:37:44 +0000 |
commit | 959b8c8257b8b6fa547c25098d1024b53e5f9b45 (patch) | |
tree | 76f8d2d85c498bea6a9f9b56ec6885cad957d6e0 /gcc/ipa-utils.c | |
parent | d0a6fcf5895c4d5c2ca8fdb50756959cc8d204b8 (diff) | |
download | gcc-959b8c8257b8b6fa547c25098d1024b53e5f9b45.zip gcc-959b8c8257b8b6fa547c25098d1024b53e5f9b45.tar.gz gcc-959b8c8257b8b6fa547c25098d1024b53e5f9b45.tar.bz2 |
ipa-utils.c (ipa_merge_profiles): Fix updating of fnsummary; also handle rescaling of mismatched profiles.
* ipa-utils.c (ipa_merge_profiles): Fix updating of fnsummary;
also handle rescaling of mismatched profiles.
* ipa-fnsummary.c (analyze_function): Handle speculative edges.
From-SVN: r267392
Diffstat (limited to 'gcc/ipa-utils.c')
-rw-r--r-- | gcc/ipa-utils.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/gcc/ipa-utils.c b/gcc/ipa-utils.c index 422d8d0..f07e3b3 100644 --- a/gcc/ipa-utils.c +++ b/gcc/ipa-utils.c @@ -392,6 +392,7 @@ ipa_merge_profiles (struct cgraph_node *dst, if (!src->definition || !dst->definition) return; + if (src->frequency < dst->frequency) src->frequency = dst->frequency; @@ -416,6 +417,8 @@ ipa_merge_profiles (struct cgraph_node *dst, fprintf (symtab->dump_file, "Merging profiles of %s to %s\n", src->dump_name (), dst->dump_name ()); } + profile_count orig_count = dst->count; + if (dst->count.initialized_p () && dst->count.ipa () == dst->count) dst->count += src->count.ipa (); else @@ -644,10 +647,21 @@ ipa_merge_profiles (struct cgraph_node *dst, if (!preserve_body) src->release_body (); /* Update summary. */ - symtab->call_cgraph_removal_hooks (dst); - symtab->call_cgraph_insertion_hooks (dst); + compute_fn_summary (dst, 0); + } + /* We can't update CFG profile, but we can scale IPA profile. CFG + will be scaled according to dst->count after IPA passes. */ + else + { + profile_count to = dst->count; + profile_count::adjust_for_ipa_scaling (&to, &orig_count); + struct cgraph_edge *e; + + for (e = dst->callees; e; e = e->next_callee) + e->count = e->count.apply_scale (to, orig_count); + for (e = dst->indirect_calls; e; e = e->next_callee) + e->count = e->count.apply_scale (to, orig_count); } - /* TODO: if there is no match, we can scale up. */ src->decl = oldsrcdecl; } |