Skip to content

Commit 6a9ea3b

Browse files
committed
abi: use PassMode::Direct even for data types that can be passed as scalar pairs.
1 parent 3b1ad48 commit 6a9ea3b

File tree

1 file changed

+9
-0
lines changed
  • crates/rustc_codegen_spirv/src

1 file changed

+9
-0
lines changed

crates/rustc_codegen_spirv/src/abi.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ pub(crate) fn provide(providers: &mut Providers) {
6969
// <https://github.com/rust-lang/rust/commit/eaaa03faf77b157907894a4207d8378ecaec7b45>
7070
arg.make_direct_deprecated();
7171

72+
// FIXME(eddyb) detect `#[rust_gpu::vector::v1]` more specifically,
73+
// to avoid affecting anything should actually be passed as a pair.
74+
if let PassMode::Pair(..) = arg.mode {
75+
// HACK(eddyb) this avoids breaking e.g. `&[T]` pairs.
76+
if let TyKind::Adt(..) = arg.layout.ty.kind() {
77+
arg.mode = PassMode::Direct(ArgAttributes::new());
78+
}
79+
}
80+
7281
// Avoid pointlessly passing ZSTs, just like the official Rust ABI.
7382
if arg.layout.is_zst() {
7483
arg.mode = PassMode::Ignore;

0 commit comments

Comments
 (0)