Skip to content

Commit 90926fd

Browse files
committed
codegen: use size-based alloca for panic arg spill
1 parent 7e26485 commit 90926fd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crates/rustc_codegen_spirv/src/builder/format_args_decompiler.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,11 @@ impl<'tcx> DecodedFormatArgs<'tcx> {
236236
}
237237
};
238238
let mut spill_value_to_local = |value: SpirvValue| {
239-
let ptr = builder.typed_alloca(value.ty, Align::ONE);
239+
let size = builder
240+
.lookup_type(value.ty)
241+
.sizeof(builder)
242+
.expect("panic argument should have a sized type");
243+
let ptr = builder.alloca(size, Align::ONE);
240244
builder.store(value, ptr, Align::ONE);
241245
match ptr.kind {
242246
SpirvValueKind::Def(id) => Some(id),

0 commit comments

Comments
 (0)