[OPT] Use RETURN_PLACE instead of fn_sig.output() to get return layout
This commit is contained in:
parent
86cdd1909b
commit
1c79cf4c0a
2 changed files with 7 additions and 16 deletions
|
|
@ -260,17 +260,6 @@ impl<'tcx, B: Backend + 'static> FunctionCx<'_, 'tcx, B> {
|
|||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn self_sig(&self) -> FnSig<'tcx> {
|
||||
self.tcx.normalize_erasing_late_bound_regions(
|
||||
ParamEnv::reveal_all(),
|
||||
&fn_sig_for_fn_abi(self.tcx, self.instance),
|
||||
)
|
||||
}
|
||||
|
||||
fn return_layout(&self) -> TyLayout<'tcx> {
|
||||
self.layout_of(self.self_sig().output())
|
||||
}
|
||||
}
|
||||
|
||||
fn local_place<'tcx>(
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
use crate::abi::pass_mode::*;
|
||||
use crate::prelude::*;
|
||||
|
||||
fn return_layout<'a, 'tcx>(fx: &mut FunctionCx<'a, 'tcx, impl Backend>) -> TyLayout<'tcx> {
|
||||
fx.layout_of(fx.monomorphize(&fx.mir.local_decls[RETURN_PLACE].ty))
|
||||
}
|
||||
|
||||
pub fn codegen_return_param(
|
||||
fx: &mut FunctionCx<impl Backend>,
|
||||
ssa_analyzed: &rustc_index::vec::IndexVec<Local, crate::analyze::SsaKind>,
|
||||
start_ebb: Ebb,
|
||||
) {
|
||||
let ret_layout = fx.return_layout();
|
||||
let output_pass_mode = get_pass_mode(fx.tcx, fx.return_layout());
|
||||
|
||||
let ret_param = match output_pass_mode {
|
||||
let ret_layout = return_layout(fx);
|
||||
let ret_param = match get_pass_mode(fx.tcx, ret_layout) {
|
||||
PassMode::NoPass => {
|
||||
fx.local_map
|
||||
.insert(RETURN_PLACE, CPlace::no_place(ret_layout));
|
||||
|
|
@ -85,7 +87,7 @@ pub fn codegen_with_call_return_arg<'tcx, B: Backend, T>(
|
|||
}
|
||||
|
||||
pub fn codegen_return(fx: &mut FunctionCx<impl Backend>) {
|
||||
match get_pass_mode(fx.tcx, fx.return_layout()) {
|
||||
match get_pass_mode(fx.tcx, return_layout(fx)) {
|
||||
PassMode::NoPass | PassMode::ByRef => {
|
||||
fx.bcx.ins().return_(&[]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue