@@ -2735,6 +2735,7 @@ where
2735
2735
can_unwind : fn_can_unwind ( cx. tcx ( ) . sess . panic_strategy ( ) , codegen_fn_attr_flags, conv) ,
2736
2736
} ;
2737
2737
fn_abi. adjust_for_abi ( cx, sig. abi ) ;
2738
+ debug ! ( "FnAbi::new_internal = {:?}" , fn_abi) ;
2738
2739
fn_abi
2739
2740
}
2740
2741
@@ -2748,7 +2749,7 @@ where
2748
2749
|| abi == SpecAbi :: RustIntrinsic
2749
2750
|| abi == SpecAbi :: PlatformIntrinsic
2750
2751
{
2751
- let fixup = |arg : & mut ArgAbi < ' tcx , Ty < ' tcx > > | {
2752
+ let fixup = |arg : & mut ArgAbi < ' tcx , Ty < ' tcx > > , is_ret : bool | {
2752
2753
if arg. is_ignore ( ) {
2753
2754
return ;
2754
2755
}
@@ -2786,8 +2787,11 @@ where
2786
2787
_ => return ,
2787
2788
}
2788
2789
2790
+ let max_by_val_size =
2791
+ if is_ret { call:: max_ret_by_val ( cx) } else { Pointer . size ( cx) } ;
2789
2792
let size = arg. layout . size ;
2790
- if arg. layout . is_unsized ( ) || size > Pointer . size ( cx) {
2793
+
2794
+ if arg. layout . is_unsized ( ) || size > max_by_val_size {
2791
2795
arg. make_indirect ( ) ;
2792
2796
} else {
2793
2797
// We want to pass small aggregates as immediates, but using
@@ -2796,9 +2800,9 @@ where
2796
2800
arg. cast_to ( Reg { kind : RegKind :: Integer , size } ) ;
2797
2801
}
2798
2802
} ;
2799
- fixup ( & mut self . ret ) ;
2803
+ fixup ( & mut self . ret , true ) ;
2800
2804
for arg in & mut self . args {
2801
- fixup ( arg) ;
2805
+ fixup ( arg, false ) ;
2802
2806
}
2803
2807
if let PassMode :: Indirect ( ref mut attrs, _) = self . ret . mode {
2804
2808
attrs. set ( ArgAttribute :: StructRet ) ;
0 commit comments