Ping? Thanks, Kugan
> On 2 Jun 2026, at 11:16 am, Kugan Vivekanandarajah <[email protected]> > wrote: > > External email: Use caution opening links or attachments > > > Ping? > > Thanks > Kugan > >> On 19 May 2026, at 10:30 am, Kugan Vivekanandarajah >> <[email protected]> wrote: >> >> External email: Use caution opening links or attachments >> Hi, >> >> This is another attempt to prevent head_count of 0 with AFDO profile. This >> is causing ICE with LTO: >> >> during IPA pass: modref >> lto1: internal compiler error: in apply_scale, at profile-count.h:1192 >> 0x2292433 internal_error(char const*, ...) >> /var/jenkins/workspace/GCC_oss-main/gcc/diagnostic-global-context.cc:787 >> 0x8a2ba7 fancy_abort(char const*, int, char const*) >> /var/jenkins/workspace/GCC_oss-main/gcc/diagnostics/context.cc:1813 >> 0x98efcf profile_count::apply_scale(profile_count, profile_count) const >> /var/jenkins/workspace/GCC_oss-main/gcc/profile-count.h:1192 >> 0xd2536f ipa_merge_profiles(cgraph_node*, cgraph_node*, bool) >> /var/jenkins/workspace/GCC_oss-main/gcc/ipa-utils.cc:637 >> 0x8fc01b lto_symtab_merge_symbols_1 >> /var/jenkins/workspace/GCC_oss-main/gcc/lto/lto-symtab.cc:934 >> 0x8fc01b lto_symtab_merge_symbols() >> /var/jenkins/workspace/GCC_oss-main/gcc/lto/lto-symtab.cc:996 >> 0x90b7f7 read_cgraph_and_symbols(unsigned int, char const**) >> /var/jenkins/workspace/GCC_oss-main/gcc/lto/lto-common.cc:3003 >> 0x8e8abf lto_main() >> /var/jenkins/workspace/GCC_oss-main/gcc/lto/lto.cc:663 <http://lto.cc:663/> >> >> >> >> When afdo_adjust_guessed_profile runs scale_bbs, the entry block can be >> scaled to 0 (auto FDO) while inner basic blocks keep nonzero AFDO >> counts. >> >> Example from profile annotation (stats.ii, _M_get_insert_unique_pos): >> ... total:264 head:-1 >> bb 0 count updated 118111600 (estimated locally) -> 0 (auto FDO) >> Example ICE at LTO (WPA merge of comdat clones): >> Merging profiles of _M_get_insert_unique_pos/10 count:64711123189 >> (auto FDO) >> to _M_get_insert_unique_pos/1 count:0 (auto FDO) >> during IPA pass: modref >> lto1: internal compiler error: in apply_scale, at profile-count.h:1192 >> ipa_merge_profiles (dstnum, dstden) >> >> Fix by calling afdo_fixup_entry_after_scale immediately after each >> scale_bbs in afdo_adjust_guessed_profile when max_count_in_fn is nonzero >> but the entry block count is still zero. >> >> gcc/ChangeLog: >> * auto-profile.cc (afdo_fixup_entry_after_scale): New. >> (afdo_adjust_guessed_profile): Call it after scale_bbs. >> >> Regression tested on aarch64-linux-gnu with no new regressions. Is this OK >> for trunk? >> >> Thanks, >> Kugan >> >> >> >> >> >> >> <0001-AutoFDO-Do-not-leave-entry-block-at-zero-after-guess.patch> >
