Skip to content

Make hint::cold_path #[cold] so that it works even if the MIR inliner can't inline it#156863

Open
saethlin wants to merge 1 commit into
rust-lang:mainfrom
saethlin:silly-cold-path
Open

Make hint::cold_path #[cold] so that it works even if the MIR inliner can't inline it#156863
saethlin wants to merge 1 commit into
rust-lang:mainfrom
saethlin:silly-cold-path

Conversation

@saethlin
Copy link
Copy Markdown
Member

This fixes #156859 because the branch weight metadata is actually keyed off seeing a #[cold] function call in an arm. We don't need the intrinsic, any #[cold] function will do. So if the hint wrapper itself is made #[cold], we will still get the desired effect, and LLVM will clean up the call to an empty function when optimizations are enabled.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 23, 2026
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 23, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 23, 2026

r? @jackh726

rustbot has assigned @jackh726.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 18 candidates

Comment thread tests/codegen-llvm/hint/cold_path.rs Outdated
@rust-log-analyzer

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

target_feature(enable = ...) interferes with core::hint::cold_path

5 participants