Hi Honza,

Thanks for the review.

> On 4 Aug 2026, at 5:07 pm, Jan Hubička <[email protected]> wrote:
> 
> External email: Use caution opening links or attachments 
> Kugan,
> I apologize for late reaction. I finally got to reproduce this.
> I think we want to set the entry block count to
>  MAX (1, afdo_count_scale / 2)
> Receiving 0 samples on code that is known to be executed means that the real 
> value should be somewhere between 0 and 1, so 1/2 is good estimate.  Setting 
> count 1 will make all basic blocks to appear very hot and confuse the logic 
> computing BB frequency.
> 
> Also I think you can do that just once in  afdo_calculate_branch_prob
> just after calling afdo_adjust_guessed_profile instead of doing it as a
> part of the fixup algorithm (which is already bit complicated).

Yes, this helps. I have added in one place as you suggested and this fixes the 
ICE.
If you don't have any objections, I will commit this patch. 

Thanks,
Kugan

Attachment: 0001-AutoFDO-Do-not-leave-entry-block-at-zero-after-guess.patch
Description: 0001-AutoFDO-Do-not-leave-entry-block-at-zero-after-guess.patch

Reply via email to