diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-01-31 20:22:01 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-02-12 17:48:04 +0000 |
| commit | 55200e75da337a17e0daa333e1f3e70b5aa18e8a (patch) | |
| tree | 48d4ae5d77f965fe7ded86257b648907e26d99b2 | |
| parent | 8549c0a3e6b39b31f29f308d3b33744aaefa4080 (diff) | |
| download | rust-55200e75da337a17e0daa333e1f3e70b5aa18e8a.tar.gz rust-55200e75da337a17e0daa333e1f3e70b5aa18e8a.zip | |
Do the entire ReturnDest computation within make_return_dest
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/block.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index a4d97200cdb..df5a2c29ef0 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs @@ -820,12 +820,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let mut llargs = Vec::with_capacity(arg_count); // Prepare the return value destination - let ret_dest = if target.is_some() { - let is_intrinsic = intrinsic.is_some(); - self.make_return_dest(bx, destination, &fn_abi.ret, &mut llargs, is_intrinsic) - } else { - ReturnDest::Nothing - }; + let ret_dest = self.make_return_dest( + bx, + destination, + &fn_abi.ret, + &mut llargs, + intrinsic.is_some(), + target.is_some(), + ); if intrinsic == Some(sym::caller_location) { return if let Some(target) = target { @@ -1632,7 +1634,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { fn_ret: &ArgAbi<'tcx, Ty<'tcx>>, llargs: &mut Vec<Bx::Value>, is_intrinsic: bool, + has_target: bool, ) -> ReturnDest<'tcx, Bx::Value> { + if !has_target { + return ReturnDest::Nothing; + } // If the return is ignored, we can just return a do-nothing `ReturnDest`. if fn_ret.is_ignore() { return ReturnDest::Nothing; |
