Hi, > On 4 Jun 2025, at 9:53 pm, Jan Hubicka <hubi...@ucw.cz> wrote: > > External email: Use caution opening links or attachments > > >> This patch introduces a new testcase to verify the merging of profiles >> is performed for cloned functions. >> >> Since this is invoked very early, before the pass manager, we need to >> set up the dumping explicitly. This is similar to the handling in >> finish_optimization_passes. >> >> gcc/ChangeLog: >> >> * auto-profile.cc (autofdo_source_profile::read): Dump message >> while merging profile. >> * pass_manager.h (get_pass_auto_profile): New. >> >> gcc/testsuite/ChangeLog: >> >> * gcc.dg/tree-prof/clone-merge-1.c: New test. >> >> Is this OK? > OK, thanks! > It would be nice to also test that some afdo based optimization happens > (i.e. have indirect call in the cloned function or so), so we check that > the merged data actually works, but having a dump and check that > something is done is already good :) > > BTW I now see main remaining spec2k17 regresions in omnetpp and > imagemagick (small regressions are also in deepsjeng, leela, namd). > I plan to investigate them, or do you happen to know what is goind on > there? > > I still test with LTO and post-AFDO cloning disabled. Newly I noticed > that the create_gcov tool seems to mishandle partitioned functions, so I > also disable function partitioning (which is not on by default on ARM, > but I think it would be useful to get it working).
Thanks! Do you log your results publicly as you do with other spec2017 runs? I tried running spec2017 to get some latest numbers but hittting assertion with `profile_count::compatible_p`. Should we make GUESSED_LOCAL count too to AFDO type or drop it to zero. Here is an example ICE: Cactus/piraha/Bracket.cc:133:1: internal compiler error: in combine_with_ipa_count_within, at profile-count.cc:414 133 | } | ^ 0x25f995b internal_error(char const*, ...) ../../gcc/gcc/diagnostic-global-context.cc:517 0x8589eb fancy_abort(char const*, int, char const*) ../../gcc/gcc/diagnostic.cc:1803 0x1269533 profile_count::combine_with_ipa_count_within(profile_count, profile_count) ../../gcc/gcc/profile-count.cc:414 0xdbd83b cgraph_node::create_clone(tree_node*, profile_count, bool, vec<cgraph_edge*, va_heap, vl_ptr>, bool, cgraph_node*, ipa_param_adjustments*, char const*) ../../gcc/gcc/cgraphclones.cc:410 0x108603f clone_inlined_nodes(cgraph_edge*, bool, bool, int*) ../../gcc/gcc/ipa-inline-transform.cc:224 0x10860a3 clone_inlined_nodes(cgraph_edge*, bool, bool, int*) ../../gcc/gcc/ipa-inline-transform.cc:248 0x1086947 inline_call(cgraph_edge*, bool, vec<cgraph_edge*, va_heap, vl_ptr>*, int*, bool, bool*) ../../gcc/gcc/ipa-inline-transform.cc:516 0x23fe81b inline_small_functions ../../gcc/gcc/ipa-inline.cc:2434 0x23fe81b ipa_inline ../../gcc/gcc/ipa-inline.cc:2916 0x23fe81b execute ../../gcc/gcc/ipa-inline.cc:3314 <http://ipa-inline.cc:3314/> --- a/gcc/auto-profile.cc +++ b/gcc/auto-profile.cc @@ -1119,7 +1119,8 @@ update_count_by_afdo_count (profile_count *count, gcov_type c) *count = profile_count::from_gcov_type (c).afdo (); /* In case we have guessed profile which is already zero, preserve quality info. */ - else if (count->nonzero_p () + else if (!count->nonzero_p () + || count->quality () == GUESSED_LOCAL || count->quality () == GUESSED) *count = profile_count::zero ().afdo (); } Thanks, Kugan > > Honza >> >> Thanks, >> Kugan