Skip to content

Feat - #[inline(always)] + #[target_feature(enable = "....")] #2 - #162460

Open
Jamesbarford wants to merge 2 commits into
rust-lang:mainfrom
Jamesbarford:feat/inline-always+target-feature-#2
Open

Jamesbarford wants to merge 2 commits into
rust-lang:mainfrom
Jamesbarford:feat/inline-always+target-feature-#2

Conversation

@Jamesbarford

@Jamesbarford Jamesbarford commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

View all comments

This is broadly a resurrection of #[inline(always)] + #[target_feature(enable = "...")].

This should now be sound thanks to

Therefore, it should be okay to just allow this combination. But we can also have a period of unstable experimentation if t-lang prefers.

r? @RalfJung

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 8, 2026
@rustbot

rustbot commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

RalfJung is not on the review rotation at the moment.
They may take a while to respond.

@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 Sep 8, 2026
@RalfJung

RalfJung commented Sep 8, 2026

Copy link
Copy Markdown
Member

I am not available for reviews at the moment, sorry.
r? @nikic

@rustbot rustbot assigned nikic and unassigned RalfJung Sep 8, 2026
@RalfJung

RalfJung commented Sep 8, 2026

Copy link
Copy Markdown
Member

Given LLVM is the validator it seems defensible to remove any Rust-side validation. Thus I removed the code for checking mismatching target features.

Which code are you referring to here?

Comment thread compiler/rustc_feature/src/unstable.rs Outdated
@Jamesbarford

Copy link
Copy Markdown
Contributor Author

Given LLVM is the validator it seems defensible to remove any Rust-side validation. Thus I removed the code for checking mismatching target features.

Which code are you referring to here?

I was referring to previous attempts at this such as; #155426 Where I made Rust-side error messages.

@RalfJung

RalfJung commented Sep 8, 2026

Copy link
Copy Markdown
Member

But you're not removing any checks that currently exist in the compiler, right? (Except for the ban on inline(always) + target_features of course.)

@Jamesbarford
Jamesbarford force-pushed the feat/inline-always+target-feature-#2 branch from dd6d37d to bedba2e Compare September 8, 2026 10:20
@Jamesbarford

Copy link
Copy Markdown
Contributor Author

But you're not removing any checks that currently exist in the compiler, right? (Except for the ban on inline(always) + target_features of course.)

Yes 👍, I've made those removals another commit along with removing the tests bedba2e

Comment thread tests/ui/target-feature/inline-always-runtime.rs Outdated
@RalfJung

RalfJung commented Sep 8, 2026

Copy link
Copy Markdown
Member

But you're not removing any checks that currently exist in the compiler, right? (Except for the ban on inline(always) + target_features of course.)

Yes 👍, I've made those removals another commit along with removing the tests bedba2e

I was asking about the original PR description. You now have changed the PR in response to my other comment, right?

That's fine but very confusing the way you are talking about it.


I see no reason to have this as an unstable feature. This was only ever working around LLVM bugs anyway (or, LLVM choices we weren't happy with, depending on how you want to put it). Now that LLVM is fixed we can rip off the bandaid. Let's nominate for t-lang then since this allows more code to compile -- are you happy with allowing inline(always) + target_feature, provided that we are reasonably sure that this is sound to do now? Or would you like to see some period of unstable experimentation first?

@rustbot label +I-lang-nominated
Cc @rust-lang/opsem

@rustbot rustbot added the I-lang-nominated Nominated for discussion during a lang team meeting. label Sep 8, 2026
@RalfJung RalfJung added the needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. label Sep 8, 2026
@saethlin

saethlin commented Sep 9, 2026

Copy link
Copy Markdown
Member

I never got around to investigating this, but I did confirm that codegen changes somewhere if you remove the call site attributes. So yes it's goofy but I think someone needs to understand what our call site attributes are doing before we make the change.

@Jamesbarford

Copy link
Copy Markdown
Contributor Author

But you're not removing any checks that currently exist in the compiler, right? (Except for the ban on inline(always) + target_features of course.)

Yes 👍, I've made those removals another commit along with removing the tests bedba2e

I was asking about the original PR description. You now have changed the PR in response to my other comment, right?

That's fine but very confusing the way you are talking about it.

I see no reason to have this as an unstable feature. This was only ever working around LLVM bugs anyway (or, LLVM choices we weren't happy with, depending on how you want to put it). Now that LLVM is fixed we can rip off the bandaid. Let's nominate for t-lang then since this allows more code to compile -- are you happy with allowing inline(always) + target_feature, provided that we are reasonably sure that this is sound to do now? Or would you like to see some period of unstable experimentation first?

@rustbot label +I-lang-nominated Cc @rust-lang/opsem

I originally changed it to remove the tracking issue. However I can see it's somewhat nebulous as to what I'm referring to so I have changed it again so I'm only mentioning this PR.

@RalfJung RalfJung Sep 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Removed features never get removed from this file. Please undo the change here.

View changes since the review

@RalfJung RalfJung Sep 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Removed lints never get removed from this file. Please undo the change here. You may want to update the justification string, but you have to keep the register_removed.

View changes since the review

@rust-log-analyzer

This comment has been minimized.

@Jamesbarford
Jamesbarford force-pushed the feat/inline-always+target-feature-#2 branch from 1f44c89 to 751e4f1 Compare September 9, 2026 08:21
@Jamesbarford
Jamesbarford force-pushed the feat/inline-always+target-feature-#2 branch from 751e4f1 to 69d5f24 Compare September 10, 2026 13:11
@rustbot

rustbot commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@traviscross traviscross added the P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang label Sep 16, 2026
@Jamesbarford

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 17, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 17, 2026
…#2, r=<try>

Feat - `#[inline(always)] + #[target_feature(enable = "....")]` #2
@rust-bors

rust-bors Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 93fa2b5 (93fa2b547ea8b60d7d246505f4379269b43cc06d)
Base parent: c999cef (c999cef531ea9059e189e82fe0e82c5daf249bc9)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (93fa2b5): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.3% [-0.4%, -0.3%] 7
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -2.5%, secondary -0.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.3% [3.3%, 3.3%] 2
Improvements ✅
(primary)
-2.5% [-2.8%, -2.2%] 2
Improvements ✅
(secondary)
-2.3% [-3.1%, -1.8%] 4
All ❌✅ (primary) -2.5% [-2.8%, -2.2%] 2

Cycles

Results (primary 1.8%, secondary -0.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.8% [1.8%, 1.8%] 1
Regressions ❌
(secondary)
1.9% [1.9%, 1.9%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.5% [-2.5%, -2.5%] 1
All ❌✅ (primary) 1.8% [1.8%, 1.8%] 1

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 500.132s -> 495.548s (-0.92%)
Artifact size: 406.81 MiB -> 406.90 MiB (0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 17, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 19, 2026
…ributes-at-callsite, r=saethlin

Remove applying inline attributes at the callsite

Following from our discussion and the currently open PR; rust-lang#162460, removing the blanket addition of inline attributes at the callsite, even without the `#[inline(always)]` changes, looks to now have negligible impact.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 19, 2026
…ributes-at-callsite, r=saethlin

Remove applying inline attributes at the callsite

Following from our discussion and the currently open PR; rust-lang#162460, removing the blanket addition of inline attributes at the callsite, even without the `#[inline(always)]` changes, looks to now have negligible impact.
rust-bors Bot pushed a commit that referenced this pull request Sep 19, 2026
Rollup merge of #162924 - Jamesbarford:fix/remove-inline-attributes-at-callsite, r=saethlin

Remove applying inline attributes at the callsite

Following from our discussion and the currently open PR; #162460, removing the blanket addition of inline attributes at the callsite, even without the `#[inline(always)]` changes, looks to now have negligible impact.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. I-lang-nominated Nominated for discussion during a lang team meeting. needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang 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.

9 participants