@@ -14,8 +14,7 @@ use rustc_session::{config::OptLevel, DataTypeKind, FieldInfo, SizeKind, Variant
14
14
use rustc_span:: symbol:: Symbol ;
15
15
use rustc_span:: { Span , DUMMY_SP } ;
16
16
use rustc_target:: abi:: call:: {
17
- ArgAbi , ArgAttribute , ArgAttributes , ArgExtension , Conv , FnAbi , HomogeneousAggregate , PassMode ,
18
- Reg , RegKind ,
17
+ ArgAbi , ArgAttribute , ArgAttributes , ArgExtension , Conv , FnAbi , PassMode , Reg , RegKind ,
19
18
} ;
20
19
use rustc_target:: abi:: * ;
21
20
use rustc_target:: spec:: { abi:: Abi as SpecAbi , HasTargetSpec , PanicStrategy , Target } ;
@@ -3341,6 +3340,17 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
3341
3340
Ok ( self . tcx . arena . alloc ( fn_abi) )
3342
3341
}
3343
3342
3343
+ /// Small heuristic for determining if layout has any float primitive
3344
+ fn has_all_float ( & self , layout : & ' _ TyAndLayout < ' tcx > ) -> bool {
3345
+ match layout. abi {
3346
+ Abi :: Uninhabited | Abi :: Vector { .. } => false ,
3347
+ Abi :: Scalar ( scalar) => matches ! ( scalar. primitive( ) , Primitive :: F32 | Primitive :: F64 ) ,
3348
+ Abi :: ScalarPair ( ..) | Abi :: Aggregate { .. } => {
3349
+ ( 0 ..layout. fields . count ( ) ) . all ( |i| self . has_all_float ( & layout. field ( self , i) ) )
3350
+ }
3351
+ }
3352
+ }
3353
+
3344
3354
fn fn_abi_adjust_for_abi (
3345
3355
& self ,
3346
3356
fn_abi : & mut FnAbi < ' tcx , Ty < ' tcx > > ,
@@ -3370,11 +3380,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
3370
3380
3371
3381
if arg. layout . is_unsized ( ) || size > max_by_val_size {
3372
3382
arg. make_indirect ( ) ;
3373
- } else if let Ok ( HomogeneousAggregate :: Homogeneous ( Reg {
3374
- kind : RegKind :: Float ,
3375
- ..
3376
- } ) ) = arg. layout . homogeneous_aggregate ( self )
3377
- {
3383
+ } else if unlikely ! ( self . has_all_float( & arg. layout) ) {
3378
3384
// We don't want to aggregate floats as an aggregates of Integer
3379
3385
// because this will hurt the generated assembly (#93490)
3380
3386
//
0 commit comments