1
Fork 0

Do the entire ReturnDest computation within make_return_dest

This commit is contained in:
Oli Scherer 2024-01-31 20:22:01 +00:00
parent 8549c0a3e6
commit 55200e75da

View file

@ -820,12 +820,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let mut llargs = Vec::with_capacity(arg_count); let mut llargs = Vec::with_capacity(arg_count);
// Prepare the return value destination // Prepare the return value destination
let ret_dest = if target.is_some() { let ret_dest = self.make_return_dest(
let is_intrinsic = intrinsic.is_some(); bx,
self.make_return_dest(bx, destination, &fn_abi.ret, &mut llargs, is_intrinsic) destination,
} else { &fn_abi.ret,
ReturnDest::Nothing &mut llargs,
}; intrinsic.is_some(),
target.is_some(),
);
if intrinsic == Some(sym::caller_location) { if intrinsic == Some(sym::caller_location) {
return if let Some(target) = target { 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>>, fn_ret: &ArgAbi<'tcx, Ty<'tcx>>,
llargs: &mut Vec<Bx::Value>, llargs: &mut Vec<Bx::Value>,
is_intrinsic: bool, is_intrinsic: bool,
has_target: bool,
) -> ReturnDest<'tcx, Bx::Value> { ) -> ReturnDest<'tcx, Bx::Value> {
if !has_target {
return ReturnDest::Nothing;
}
// If the return is ignored, we can just return a do-nothing `ReturnDest`. // If the return is ignored, we can just return a do-nothing `ReturnDest`.
if fn_ret.is_ignore() { if fn_ret.is_ignore() {
return ReturnDest::Nothing; return ReturnDest::Nothing;