KEMBAR78
Remove usage of `[[likely]]` and `[[unlikely]]` by StephanTLavavej · Pull Request #5255 · microsoft/STL · GitHub
Skip to content

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
@StephanTLavavej StephanTLavavej mentioned this pull request Feb 11, 2025
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