diff --git a/compiler/rustc_target/src/callconv/mod.rs b/compiler/rustc_target/src/callconv/mod.rs index 07ee3f892b7..5d120a68059 100644 --- a/compiler/rustc_target/src/callconv/mod.rs +++ b/compiler/rustc_target/src/callconv/mod.rs @@ -720,28 +720,6 @@ pub fn adjust_for_foreign_abi( Ok(()) } - - pub fn fill_inregs_for_rust_abi(&mut self, cx: &C) - where - Ty: TyAbiInterface<'a, C> + Copy, - C: HasTargetSpec + HasX86AbiOpt, - { - let spec = cx.target_spec(); - match &spec.arch[..] { - "x86" => { - x86::fill_inregs( - cx, - self, - x86::X86Options { - flavor: x86::Flavor::General, - regparm: cx.x86_abi_opt().regparm, - }, - true, - ); - } - _ => {} - } - } } impl FromStr for Conv { diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs index 661f140e697..deda16b76b5 100644 --- a/compiler/rustc_ty_utils/src/abi.rs +++ b/compiler/rustc_ty_utils/src/abi.rs @@ -797,9 +797,6 @@ fn unadjust<'tcx>(arg: &mut ArgAbi<'tcx, Ty<'tcx>>) { for (arg_idx, arg) in fn_abi.args.iter_mut().enumerate() { fixup(arg, Some(arg_idx)); } - if tcx.sess.target.arch == "x86" { - fn_abi.fill_inregs_for_rust_abi(cx); - } } else { fn_abi .adjust_for_foreign_abi(cx, abi) diff --git a/tests/codegen/regparm-inreg-rust-cc.rs b/tests/codegen/regparm-inreg-rust-cc.rs deleted file mode 100644 index a2d8d5349ea..00000000000 --- a/tests/codegen/regparm-inreg-rust-cc.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Checks how `regparm` flag works with Rust calling convention with array types. -// When there is a small array type in signature (casted to combined int type), -// inregs will not be set. PassMode::Cast is unsupported. -// x86 only. - -//@ compile-flags: --target i686-unknown-linux-gnu -O -C no-prepopulate-passes -//@ needs-llvm-components: x86 - -//@ revisions:regparm0 regparm1 regparm2 regparm3 -//@[regparm0] compile-flags: -Zregparm=0 -//@[regparm1] compile-flags: -Zregparm=1 -//@[regparm2] compile-flags: -Zregparm=2 -//@[regparm3] compile-flags: -Zregparm=3 - -#![crate_type = "lib"] -#![no_core] -#![feature(no_core, lang_items)] - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -pub mod tests { - // CHECK: @f1(i16 %0, i32 noundef %_2, i32 noundef %_3) - #[no_mangle] - pub extern "Rust" fn f1(_: [u8; 2], _: i32, _: i32) {} - - // CHECK: @f2(i24 %0, i32 noundef %_2, i32 noundef %_3) - #[no_mangle] - pub extern "Rust" fn f2(_: [u8; 3], _: i32, _: i32) {} - - // regparm0: @f3(ptr {{.*}} %_1, i32 noundef %_2, i32 noundef %_3) - // regparm1: @f3(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 noundef %_3) - // regparm2: @f3(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 inreg noundef %_3) - // regparm3: @f3(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 inreg noundef %_3) - #[no_mangle] - pub extern "Rust" fn f3(_: [u8; 7], _: i32, _: i32) {} - - // regparm0: @f4(ptr {{.*}} %_1, i32 noundef %_2, i32 noundef %_3) - // regparm1: @f4(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 noundef %_3) - // regparm2: @f4(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 inreg noundef %_3) - // regparm3: @f4(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 inreg noundef %_3) - #[no_mangle] - pub extern "Rust" fn f4(_: [u8; 11], _: i32, _: i32) {} - - // regparm0: @f5(ptr {{.*}} %_1, i32 noundef %_2, i32 noundef %_3) - // regparm1: @f5(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 noundef %_3) - // regparm2: @f5(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 inreg noundef %_3) - // regparm3: @f5(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 inreg noundef %_3) - #[no_mangle] - pub extern "Rust" fn f5(_: [u8; 33], _: i32, _: i32) {} -} diff --git a/tests/codegen/regparm-inreg.rs b/tests/codegen/regparm-inreg.rs index 188cad9271e..c8c647bcc87 100644 --- a/tests/codegen/regparm-inreg.rs +++ b/tests/codegen/regparm-inreg.rs @@ -25,13 +25,6 @@ pub mod tests { #[no_mangle] pub extern "fastcall" fn f1(_: i32, _: i32, _: i32) {} - // regparm0: @f2(i32 noundef %_1, i32 noundef %_2, i32 noundef %_3) - // regparm1: @f2(i32 inreg noundef %_1, i32 noundef %_2, i32 noundef %_3) - // regparm2: @f2(i32 inreg noundef %_1, i32 inreg noundef %_2, i32 noundef %_3) - // regparm3: @f2(i32 inreg noundef %_1, i32 inreg noundef %_2, i32 inreg noundef %_3) - #[no_mangle] - pub extern "Rust" fn f2(_: i32, _: i32, _: i32) {} - // regparm0: @f3(i32 noundef %_1, i32 noundef %_2, i32 noundef %_3) // regparm1: @f3(i32 inreg noundef %_1, i32 noundef %_2, i32 noundef %_3) // regparm2: @f3(i32 inreg noundef %_1, i32 inreg noundef %_2, i32 noundef %_3)