Hi Honza,

>
> In general passes that possibly put ENTRY_BLOCK_PTR (fn)->count to zero should
> watch for it and drop the profile to GLOBAL0 variant.  Do you know from
> where the zero count originates? There is logic in auto-profile doing
> that. Other places, like cloning and inlining watches that, too.
>

We set this in auto-profile pass.  We have:

ipa_merge_profiles: zero denominator when merging 
src=_M_get_insert_unique_pos/30625 dst=_M_get_insert_unique_pos/1549
  srcden: 21942576032 (guessed) (quality: guessed)
  dstden: 0 (auto FDO) (quality: afdo)
during IPA pass: modref

In anywise, in the ipa_merge_profiles, we should pick the FDO profile if the 
other is GUESSED. IMO, this is the correct behaviour given that we would have 
profiled after merging in mist cases.

Attached patch prefers AFDO profile if either src or deer is quality AFDO and 
the other is GUSSED. Regression tested on aarch64-linux-gnu with no new 
regressions.

Is this OK?

Thanks,
Kugan



Attachment: 0001-AutoFDO-Keep-accurate-profile-in-ipa_merge_profiles-.patch
Description: 0001-AutoFDO-Keep-accurate-profile-in-ipa_merge_profiles-.patch

Reply via email to