Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usage of [[likely]] and [[unlikely]] #5255

Merged
merged 3 commits into from
Jan 29, 2025

Conversation

StephanTLavavej
Copy link
Member

@StephanTLavavej StephanTLavavej commented Jan 27, 2025

@GabrielDosReis informed me that the optimizer team discourages use of the [[likely]] and [[unlikely]] attributes, and instead encourages PGO/SPGO. (This aligns with what I've always said, "don't help the compiler".) We've accumulated a fair amount of usage of these attributes, none of which was motivated by benchmarking. Let's remove this noise from our codebase. If we ever find places where it actually affects performance (presumably for Clang/LLVM, since C2 pays minimal attention to the attribute), we can decide what to do.

  • Remove direct usage of [[likely]] and [[unlikely]].
  • Remove _LIKELY_X86_X64, _LIKELY_ARM_ARM64, and clang-format suppression.
  • Remove _LIKELY and _UNLIKELY.

@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Jan 27, 2025
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner January 27, 2025 19:07
@AlexGuteniev

This comment was marked as resolved.

@GabrielDosReis

This comment was marked as resolved.

@AlexGuteniev

This comment was marked as resolved.

@StephanTLavavej

This comment was marked as resolved.

Copy link
Member

@MahmoudGSaleh MahmoudGSaleh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@StephanTLavavej StephanTLavavej self-assigned this Jan 28, 2025
@StephanTLavavej
Copy link
Member Author

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 2314e1a into microsoft:main Jan 29, 2025
39 checks passed
@StephanTLavavej StephanTLavavej deleted the a-likely-story branch January 29, 2025 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants