Skip to content

Reinstate inline always - #2293

Open
Jamesbarford wants to merge 1 commit into
rust-lang:mainfrom
Jamesbarford:chore/reinstate-inline-always
Open

Jamesbarford wants to merge 1 commit into
rust-lang:mainfrom
Jamesbarford:chore/reinstate-inline-always

Conversation

@Jamesbarford

Copy link
Copy Markdown
Contributor

@rustbot

rustbot commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

r? @Amanieu

rustbot has assigned @Amanieu.
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: @Amanieu, @adamgemmell, @davidtwco, @folkertdev
  • @Amanieu, @adamgemmell, @davidtwco, @folkertdev expanded to Amanieu, adamgemmell, davidtwco, folkertdev
  • Random selection from Amanieu, adamgemmell, davidtwco, folkertdev

@Jamesbarford
Jamesbarford force-pushed the chore/reinstate-inline-always branch from c6c26ce to 412e171 Compare December 2, 2026 15:24
@Jamesbarford
Jamesbarford force-pushed the chore/reinstate-inline-always branch from 412e171 to f246899 Compare December 2, 2026 15:25
@Amanieu

Amanieu commented Dec 2, 2026

Copy link
Copy Markdown
Member

I haven't been following this in detail, but what is the benefit of making these #[inline(always)] instead of #[inline]?

@Jamesbarford

Copy link
Copy Markdown
Contributor Author

I don't have a concrete example of improved codegen, but we previously defined these as #[inline(always)] before its combination with #[target_feature] was made a hard error due to soundness concerns. Now that changes in LLVM have made this combination sound and Rust supports it again, restoring the original annotations seems reasonable and potentially beneficial for codegen.

@Amanieu

Amanieu commented Dec 3, 2026

Copy link
Copy Markdown
Member

I remember there was some discussion around emitting a warning/error if inlining with #[inline(always)] fails due to mismatched target features. Is this something that is still planned?

@Jamesbarford

Copy link
Copy Markdown
Contributor Author

There is no error or warning at the moment if the target features mismatch, LLVM simply won't inline it if the target features do not match. I'm not sure if this is something that is planned.

I tried emitting an error at one point and was unsuccessful with that idea as it relied on knowing the ordering of the inline passes in LLVM, which could change (and has in the past).

This branch has not been deployed

No deployments
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.

3 participants