Landing: ab0712667b04

Project / Subsystem

gcc / gcc/auto-profile

Date

2026-08-21

Author

Kugan Vivekanandarajah

Commit

ab0712667b0461e34679cade62369a2c92fbc9be

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
gcc/auto-profile
patch_id
—
commit_hash
ab0712667b0461e34679cade62369a2c92fbc9be
source_type
github
headline
AutoFDO: Prevent entry block count from becoming zero after profile adjustment
tldr
Fixes AutoFDO profile adjustment to prevent the entry block count from being zeroed, avoiding LTO ICEs.
author
Kugan Vivekanandarajah
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • AutoFDO
  • • LTO
  • • profile-guided
  • • compiler-error
discussion_id_link
—
bugzilla_pr
—
date
2026-08-21T00:00:00.000Z

When adjusting profiles for AutoFDO, the entry block’s count could incorrectly be scaled to zero while other basic blocks retained non-zero counts. This discrepancy, particularly during LTO’s IPA passes, led to an internal compiler error (in apply_scale). This commit modifies afdo_adjust_guessed_profile to set the entry block count to half of the scaled sample count instead of zero, resolving the issue.