@@ -12,27 +12,15 @@ pub(super) fn codegen_return_param<'tcx>(
12
12
ssa_analyzed : & rustc_index:: IndexSlice < Local , crate :: analyze:: SsaKind > ,
13
13
block_params_iter : & mut impl Iterator < Item = Value > ,
14
14
) -> CPlace < ' tcx > {
15
- let ( ret_place, ret_param) : ( _ , SmallVec < [ _ ; 2 ] > ) = match fx. fn_abi . as_ref ( ) . unwrap ( ) . ret . mode {
15
+ let ( ret_place, ret_param) : ( _ , SmallVec < [ _ ; 2 ] > ) = match fx. fn_abi . ret . mode {
16
16
PassMode :: Ignore | PassMode :: Direct ( _) | PassMode :: Pair ( _, _) | PassMode :: Cast { .. } => {
17
- let is_ssa =
18
- ssa_analyzed[ RETURN_PLACE ] . is_ssa ( fx, fx. fn_abi . as_ref ( ) . unwrap ( ) . ret . layout . ty ) ;
19
- (
20
- super :: make_local_place (
21
- fx,
22
- RETURN_PLACE ,
23
- fx. fn_abi . as_ref ( ) . unwrap ( ) . ret . layout ,
24
- is_ssa,
25
- ) ,
26
- smallvec ! [ ] ,
27
- )
17
+ let is_ssa = ssa_analyzed[ RETURN_PLACE ] . is_ssa ( fx, fx. fn_abi . ret . layout . ty ) ;
18
+ ( super :: make_local_place ( fx, RETURN_PLACE , fx. fn_abi . ret . layout , is_ssa) , smallvec ! [ ] )
28
19
}
29
20
PassMode :: Indirect { attrs : _, meta_attrs : None , on_stack : _ } => {
30
21
let ret_param = block_params_iter. next ( ) . unwrap ( ) ;
31
22
assert_eq ! ( fx. bcx. func. dfg. value_type( ret_param) , fx. pointer_type) ;
32
- (
33
- CPlace :: for_ptr ( Pointer :: new ( ret_param) , fx. fn_abi . as_ref ( ) . unwrap ( ) . ret . layout ) ,
34
- smallvec ! [ ret_param] ,
35
- )
23
+ ( CPlace :: for_ptr ( Pointer :: new ( ret_param) , fx. fn_abi . ret . layout ) , smallvec ! [ ret_param] )
36
24
}
37
25
PassMode :: Indirect { attrs : _, meta_attrs : Some ( _) , on_stack : _ } => {
38
26
unreachable ! ( "unsized return value" )
@@ -45,8 +33,8 @@ pub(super) fn codegen_return_param<'tcx>(
45
33
Some ( RETURN_PLACE ) ,
46
34
None ,
47
35
& ret_param,
48
- & fx. fn_abi . as_ref ( ) . unwrap ( ) . ret . mode ,
49
- fx. fn_abi . as_ref ( ) . unwrap ( ) . ret . layout ,
36
+ & fx. fn_abi . ret . mode ,
37
+ fx. fn_abi . ret . layout ,
50
38
) ;
51
39
52
40
ret_place
@@ -115,7 +103,7 @@ pub(super) fn codegen_with_call_return_arg<'tcx>(
115
103
116
104
/// Codegen a return instruction with the right return value(s) if any.
117
105
pub ( crate ) fn codegen_return ( fx : & mut FunctionCx < ' _ , ' _ , ' _ > ) {
118
- match fx. fn_abi . as_ref ( ) . unwrap ( ) . ret . mode {
106
+ match fx. fn_abi . ret . mode {
119
107
PassMode :: Ignore | PassMode :: Indirect { attrs : _, meta_attrs : None , on_stack : _ } => {
120
108
fx. bcx . ins ( ) . return_ ( & [ ] ) ;
121
109
}
0 commit comments