Skip to content

Fix; target feature inline always#155426

Open
Jamesbarford wants to merge 3 commits intorust-lang:mainfrom
Jamesbarford:fix/target-feature-inline-always
Open

Fix; target feature inline always#155426
Jamesbarford wants to merge 3 commits intorust-lang:mainfrom
Jamesbarford:fix/target-feature-inline-always

Conversation

@Jamesbarford
Copy link
Copy Markdown
Contributor

Fixes for #[inline(always)] with target features

  • Checks if the target feature on the caller could affect the callee with an incompatible abi.
  • Checks if a globally enabled target feature makes what would otherwise not be inlined, inlined (see test; tests/ui/target-feature/inline-always-vector-abi-global-avx.rs).
  • If the callee enables any target feature the caller doesn't have, we bail.
  • If the caller enables target features the callee does not have and they do not affect the abi. We inline.
  • If the caller enables target features that affect the abi and the callee does not have those features, we bail.
  • Report errors to user both for caller mismatch and callee mismatch. But only explicitly what the user missed out, e.g we don't report that sse2,ssse3 ... etc is missing if the user wrote avx on a function and the inlining logic bails because of a mismatch.
  • Update tests to support these use cases.

Addresses concerns in #145574

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 17, 2026

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added 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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 17, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 17, 2026

r? @mejrs

rustbot has assigned @mejrs.
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 72 candidates
  • Random selection from 18 candidates

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Jamesbarford Jamesbarford force-pushed the fix/target-feature-inline-always branch from ef34bce to b269cc3 Compare April 17, 2026 11:55
@mejrs
Copy link
Copy Markdown
Contributor

mejrs commented Apr 17, 2026

This is pretty far out of my expertise, so

r? compiler

@rustbot rustbot assigned dingxiangfei2009 and unassigned mejrs Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants