Skip to content

Re-implement likely/unlikely with #[cold] #631

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

Merged
merged 1 commit into from
Aug 7, 2025

Conversation

DaniPopes
Copy link
Contributor

Since rust-lang/rust#120370 #[cold] affects branch weights in the backend (again?). Re-implement likely and unlikely in terms of a #[cold] function.

You can verify that the LLVM IR in this godbolt link contains a branch_weights metadata.

These were removed in d677fd4.

Since rust-lang/rust#120370 `#[cold]`
affects branch weights in the backend (again?). Re-implement
`likely` and `unlikely` in terms of a `#[cold]` function.

You can verify that the LLVM IR in [this godbolt link](https://godbolt.org/z/n3v7hsMqK)
contains a `branch_weights` metadata.

These were removed in rust-lang@d677fd4.
@Amanieu Amanieu added this pull request to the merge queue Aug 7, 2025
Merged via the queue into rust-lang:master with commit 4358483 Aug 7, 2025
26 checks passed
@DaniPopes DaniPopes deleted the readd-likely branch August 7, 2025 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants