Landing: 91742b4e16fd
Project / Subsystem
gcc / profile-count
Date
2026-07-16
Author
Kyrylo Tkachov
Commit
91742b4e16fd43374a0432b588fb1ec9206f77ea
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- profile-count
- patch_id
- —
- commit_hash
- 91742b4e16fd43374a0432b588fb1ec9206f77ea
- source_type
- github
- headline
- profile-count: Handle signed values in profile_probability::apply
- tldr
- Profile probability calculations now correctly handle signed inputs, preventing overflow and ensuring accurate rounding.
- author
- Kyrylo Tkachov
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • profile-count
- • PGO
- • bugfix
- • signed values
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-16T00:00:00.000Z
This commit fixes an issue in profile_probability::apply where signed input values were not handled correctly, leading to incorrect rounding and potential overflow. The function uses division, and the rounding behavior for negative numbers was problematic. The fix scales the magnitude of the signed value using safe_scale_64bit and then restores the sign, ensuring correct results. It also preserves the sign for unit probabilities and handles uninitialized probabilities as before. New selftests verify the corrected behavior.