Skip to content

Commit 53c1362

Browse files
committed
Disable vector abi check for the unadjusted abi
1 parent b75d396 commit 53c1362

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

compiler/rustc_monomorphize/src/mono_checks/abi_check.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! This module ensures that if a function's ABI requires a particular target feature,
22
//! that target feature is enabled both on the callee and all callers.
3-
use rustc_abi::{BackendRepr, RegKind};
3+
use rustc_abi::{BackendRepr, ExternAbi, RegKind};
44
use rustc_hir::{CRATE_HIR_ID, HirId};
55
use rustc_middle::mir::{self, Location, traversal};
66
use rustc_middle::ty::layout::LayoutCx;
@@ -31,10 +31,16 @@ fn uses_vector_registers(mode: &PassMode, repr: &BackendRepr) -> bool {
3131
fn do_check_simd_vector_abi<'tcx>(
3232
tcx: TyCtxt<'tcx>,
3333
abi: &FnAbi<'tcx, Ty<'tcx>>,
34+
extern_abi: ExternAbi,
3435
def_id: DefId,
3536
is_call: bool,
3637
loc: impl Fn() -> (Span, HirId),
3738
) {
39+
// we skip this check for the "unadjusted" abi
40+
if extern_abi == ExternAbi::Unadjusted {
41+
return;
42+
}
43+
3844
// We check this on all functions, including those using the "Rust" ABI.
3945
// For the "Rust" ABI it would be a bug if the lint ever triggered, but better safe than sorry.
4046
let feature_def = tcx.sess.target.features_for_correct_vector_abi();
@@ -49,11 +55,6 @@ fn do_check_simd_vector_abi<'tcx>(
4955
// Find the first feature that provides at least this vector size.
5056
let feature = match feature_def.iter().find(|(bits, _)| size.bits() <= *bits) {
5157
Some((_, feature)) => feature,
52-
None if matches!(&*tcx.sess.target.arch, "x86" | "x86_64")
53-
&& size.bits() == 8192 =>
54-
{
55-
"amx-tile"
56-
}
5758
None => {
5859
let (span, _hir_id) = loc();
5960
tcx.dcx().emit_err(errors::AbiErrorUnsupportedVectorType {
@@ -171,7 +172,8 @@ fn check_instance_abi<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) {
171172
def_id.as_local().map(|did| tcx.local_def_id_to_hir_id(did)).unwrap_or(CRATE_HIR_ID),
172173
)
173174
};
174-
do_check_simd_vector_abi(tcx, abi, instance.def_id(), /*is_call*/ false, loc);
175+
let extern_abi = instance.ty(tcx, typing_env).fn_sig(tcx).abi();
176+
do_check_simd_vector_abi(tcx, abi, extern_abi, instance.def_id(), /*is_call*/ false, loc);
175177
do_check_wasm_abi(tcx, abi, /*is_call*/ false, loc);
176178
}
177179

@@ -209,7 +211,9 @@ fn check_call_site_abi<'tcx>(
209211
// ABI failed to compute; this will not get through codegen.
210212
return;
211213
};
212-
do_check_simd_vector_abi(tcx, callee_abi, caller.def_id(), /*is_call*/ true, loc);
214+
215+
let extern_abi = callee.fn_sig(tcx).abi();
216+
do_check_simd_vector_abi(tcx, callee_abi, extern_abi, caller.def_id(), /*is_call*/ true, loc);
213217
do_check_wasm_abi(tcx, callee_abi, /*is_call*/ true, loc);
214218
}
215219

0 commit comments

Comments
 (0)