Skip to content

Commit 82e0e29

Browse files
committed
Fix for uninhabited llvm intrinsic return type
1 parent 8805b67 commit 82e0e29

File tree

1 file changed

+5
-6
lines changed
  • compiler/rustc_codegen_ssa/src/mir

1 file changed

+5
-6
lines changed

compiler/rustc_codegen_ssa/src/mir/block.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,8 +1040,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
10401040
&& let Some(name) = bx.tcx().codegen_fn_attrs(instance.def_id()).symbol_name
10411041
&& name.as_str().starts_with("llvm.")
10421042
{
1043-
let dest_ty = destination.ty(&self.mir.local_decls, bx.tcx()).ty;
1044-
let return_dest = if dest_ty.is_unit() {
1043+
let result_layout =
1044+
self.cx.layout_of(self.monomorphized_place_ty(destination.as_ref()));
1045+
1046+
let return_dest = if result_layout.is_zst() {
10451047
ReturnDest::Nothing
10461048
} else if let Some(index) = destination.as_local() {
10471049
match self.locals[index] {
@@ -1070,10 +1072,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
10701072
self.store_return(
10711073
bx,
10721074
return_dest,
1073-
&ArgAbi {
1074-
layout: bx.layout_of(dest_ty),
1075-
mode: PassMode::Direct(ArgAttributes::new()),
1076-
},
1075+
&ArgAbi { layout: result_layout, mode: PassMode::Direct(ArgAttributes::new()) },
10771076
llret,
10781077
);
10791078
return helper.funclet_br(self, bx, target, mergeable_succ);

0 commit comments

Comments
 (0)