Skip to content

Commit 55200e7

Browse files
committed
Do the entire ReturnDest computation within make_return_dest
1 parent 8549c0a commit 55200e7

File tree

1 file changed

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

1 file changed

+12
-6
lines changed

compiler/rustc_codegen_ssa/src/mir/block.rs

+12-6
Original file line numberDiff line numberDiff line change
@@ -820,12 +820,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
820820
let mut llargs = Vec::with_capacity(arg_count);
821821

822822
// Prepare the return value destination
823-
let ret_dest = if target.is_some() {
824-
let is_intrinsic = intrinsic.is_some();
825-
self.make_return_dest(bx, destination, &fn_abi.ret, &mut llargs, is_intrinsic)
826-
} else {
827-
ReturnDest::Nothing
828-
};
823+
let ret_dest = self.make_return_dest(
824+
bx,
825+
destination,
826+
&fn_abi.ret,
827+
&mut llargs,
828+
intrinsic.is_some(),
829+
target.is_some(),
830+
);
829831

830832
if intrinsic == Some(sym::caller_location) {
831833
return if let Some(target) = target {
@@ -1632,7 +1634,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
16321634
fn_ret: &ArgAbi<'tcx, Ty<'tcx>>,
16331635
llargs: &mut Vec<Bx::Value>,
16341636
is_intrinsic: bool,
1637+
has_target: bool,
16351638
) -> ReturnDest<'tcx, Bx::Value> {
1639+
if !has_target {
1640+
return ReturnDest::Nothing;
1641+
}
16361642
// If the return is ignored, we can just return a do-nothing `ReturnDest`.
16371643
if fn_ret.is_ignore() {
16381644
return ReturnDest::Nothing;

0 commit comments

Comments
 (0)