Skip to content

Don't compute FnAbi for LLVM intrinsics - #160077

Open
bjorn3 wants to merge 4 commits into
rust-lang:mainfrom
bjorn3:no_unadjusted_fn_abi
Open

Don't compute FnAbi for LLVM intrinsics#160077
bjorn3 wants to merge 4 commits into
rust-lang:mainfrom
bjorn3:no_unadjusted_fn_abi

Conversation

@bjorn3

@bjorn3 bjorn3 commented Jul 28, 2026

Copy link
Copy Markdown
Member

They don't have a sensible FnAbi, so the fact that we still compute an FnAbi for them requires us to make the ABI sanity check more lenient than it should be.

r? @RalfJung as all non-trivial changes are in Miri

@rustbot

rustbot commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

These commits modify compiler targets.
(See the Target Tier Policy.)

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

@rustbot rustbot added 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 Jul 28, 2026
@rustbot

rustbot commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

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

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

---- [codegen] tests/codegen-llvm/const-vector.rs#OPT0 stdout ----
------rustc stdout------------------------------

------rustc stderr------------------------------
warning: `extern` block uses type `minisimd::Simd<i8, 2>`, which is not FFI-safe
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:31:21
   |
31 |     fn test_i8x2(a: i8x2) -> i8;
   |                     ^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:23:1
   |
23 | pub struct Simd<T, const N: usize>(pub [T; N]);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: `#[warn(improper_ctypes)]` on by default

warning: `extern` block uses type `minisimd::Simd<i8, 2>`, which is not FFI-safe
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:33:30
   |
33 |     fn test_i8x2_two_args(a: i8x2, b: i8x2) -> i8x2;
   |                              ^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:23:1
   |
23 | pub struct Simd<T, const N: usize>(pub [T; N]);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `extern` block uses type `minisimd::Simd<i8, 2>`, which is not FFI-safe
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:33:39
   |
33 |     fn test_i8x2_two_args(a: i8x2, b: i8x2) -> i8x2;
   |                                       ^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:23:1
   |
23 | pub struct Simd<T, const N: usize>(pub [T; N]);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `extern` block uses type `minisimd::Simd<i8, 2>`, which is not FFI-safe
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:33:48
   |
33 |     fn test_i8x2_two_args(a: i8x2, b: i8x2) -> i8x2;
   |                                                ^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:23:1
   |
23 | pub struct Simd<T, const N: usize>(pub [T; N]);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `extern` block uses type `minisimd::Simd<i8, 2>`, which is not FFI-safe
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:35:32
   |
35 |     fn test_i8x2_mixed_args(a: i8x2, b: i8x2, c: u64) -> i8x2;
   |                                ^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:23:1
   |
23 | pub struct Simd<T, const N: usize>(pub [T; N]);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `extern` block uses type `minisimd::Simd<i8, 2>`, which is not FFI-safe
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:35:41
   |
35 |     fn test_i8x2_mixed_args(a: i8x2, b: i8x2, c: u64) -> i8x2;
   |                                         ^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:23:1
   |
23 | pub struct Simd<T, const N: usize>(pub [T; N]);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `extern` block uses type `minisimd::Simd<i8, 2>`, which is not FFI-safe
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:35:58
   |
35 |     fn test_i8x2_mixed_args(a: i8x2, b: i8x2, c: u64) -> i8x2;
   |                                                          ^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:23:1
   |
23 | pub struct Simd<T, const N: usize>(pub [T; N]);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `extern` block uses type `minisimd::Simd<f32, 2>`, which is not FFI-safe
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:37:30
   |
37 |     fn test_f32x2(a: f32, b: f32x2) -> f32;
   |                              ^^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:23:1
   |
23 | pub struct Simd<T, const N: usize>(pub [T; N]);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `extern` block uses type `PackedSimd<i32, 3>`, which is not FFI-safe
##[warning]   --> /checkout/tests/codegen-llvm/const-vector.rs:39:31
    |
 39 |     fn test_simd_unaligned(a: Simd<i32, 3>) -> i32;
    |                               ^^^^^^^^^^^^ not FFI-safe
    |
    = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
    = note: this struct has unspecified layout
note: the type is defined here
   --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:131:1
    |
131 | pub struct PackedSimd<T, const N: usize>(pub [T; N]);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Intrinsic has incorrect argument type!
ptr @llvm.vector.reduce.add.v3i32
warning: feature `arm_target_feature` is declared but not used
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:17:12
   |
17 | #![feature(arm_target_feature)]
   |            ^^^^^^^^^^^^^^^^^^
   |
---


------------------------------------------

error in revision `OPT0`: compilation failed!
status: exit status: 101
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/checkout/tests/codegen-llvm/const-vector.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1" "--target=wasm32-wasip1" "--cfg" "opt0" "--check-cfg" "cfg(test,FALSE,opt0,opt0_s390x)" "-O" "-Cdebug-assertions=no" "-Zcodegen-source-order" "--emit" "llvm-ir" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen-llvm/const-vector.OPT0/const-vector.ll" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-C" "no-prepopulate-passes" "-Copt-level=0"
stdout: none
--- stderr -------------------------------
warning: `extern` block uses type `minisimd::Simd<i8, 2>`, which is not FFI-safe
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:31:21
   |
31 |     fn test_i8x2(a: i8x2) -> i8;
   |                     ^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:23:1
   |
23 | pub struct Simd<T, const N: usize>(pub [T; N]);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: `#[warn(improper_ctypes)]` on by default

warning: `extern` block uses type `minisimd::Simd<i8, 2>`, which is not FFI-safe
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:33:30
   |
33 |     fn test_i8x2_two_args(a: i8x2, b: i8x2) -> i8x2;
   |                              ^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:23:1
   |
23 | pub struct Simd<T, const N: usize>(pub [T; N]);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `extern` block uses type `minisimd::Simd<i8, 2>`, which is not FFI-safe
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:33:39
   |
33 |     fn test_i8x2_two_args(a: i8x2, b: i8x2) -> i8x2;
   |                                       ^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:23:1
   |
23 | pub struct Simd<T, const N: usize>(pub [T; N]);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `extern` block uses type `minisimd::Simd<i8, 2>`, which is not FFI-safe
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:33:48
   |
33 |     fn test_i8x2_two_args(a: i8x2, b: i8x2) -> i8x2;
   |                                                ^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:23:1
   |
23 | pub struct Simd<T, const N: usize>(pub [T; N]);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `extern` block uses type `minisimd::Simd<i8, 2>`, which is not FFI-safe
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:35:32
   |
35 |     fn test_i8x2_mixed_args(a: i8x2, b: i8x2, c: u64) -> i8x2;
   |                                ^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:23:1
   |
23 | pub struct Simd<T, const N: usize>(pub [T; N]);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `extern` block uses type `minisimd::Simd<i8, 2>`, which is not FFI-safe
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:35:41
   |
35 |     fn test_i8x2_mixed_args(a: i8x2, b: i8x2, c: u64) -> i8x2;
   |                                         ^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:23:1
   |
23 | pub struct Simd<T, const N: usize>(pub [T; N]);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `extern` block uses type `minisimd::Simd<i8, 2>`, which is not FFI-safe
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:35:58
   |
35 |     fn test_i8x2_mixed_args(a: i8x2, b: i8x2, c: u64) -> i8x2;
   |                                                          ^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:23:1
   |
23 | pub struct Simd<T, const N: usize>(pub [T; N]);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `extern` block uses type `minisimd::Simd<f32, 2>`, which is not FFI-safe
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:37:30
   |
37 |     fn test_f32x2(a: f32, b: f32x2) -> f32;
   |                              ^^^^^ not FFI-safe
   |
   = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
   = note: this struct has unspecified layout
note: the type is defined here
  --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:23:1
   |
23 | pub struct Simd<T, const N: usize>(pub [T; N]);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `extern` block uses type `PackedSimd<i32, 3>`, which is not FFI-safe
##[warning]   --> /checkout/tests/codegen-llvm/const-vector.rs:39:31
    |
 39 |     fn test_simd_unaligned(a: Simd<i32, 3>) -> i32;
    |                               ^^^^^^^^^^^^ not FFI-safe
    |
    = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
    = note: this struct has unspecified layout
note: the type is defined here
   --> /checkout/tests/codegen-llvm/../auxiliary/minisimd.rs:131:1
    |
131 | pub struct PackedSimd<T, const N: usize>(pub [T; N]);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Intrinsic has incorrect argument type!
ptr @llvm.vector.reduce.add.v3i32
warning: feature `arm_target_feature` is declared but not used
##[warning]  --> /checkout/tests/codegen-llvm/const-vector.rs:17:12
   |
17 | #![feature(arm_target_feature)]
   |            ^^^^^^^^^^^^^^^^^^
   |

Comment on lines +26 to 27
func: OpTy<'tcx, M::Provenance>,
callee: FnVal<'tcx, M::ExtraFnVal>,

@RalfJung RalfJung Jul 28, 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.

This introduces redundancy (func and callee conceptually contain the same data). So I am not a fan of this.

What's the rationale for these non-trivial interpreter changes? I would understand making the fn_abi field an Option for calls that don't need an ABI, but this goes much beyond that it seems, by entirely removing fn_abi (and fn_sig).

View changes since the review

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants