@@ -14,7 +14,7 @@ use rustc_session::{config::OptLevel, DataTypeKind, FieldInfo, SizeKind, Variant
1414use rustc_span:: symbol:: Symbol ;
1515use rustc_span:: { Span , DUMMY_SP } ;
1616use rustc_target:: abi:: call:: {
17- ArgAbi , ArgAttribute , ArgAttributes , ArgExtension , Conv , FnAbi , PassMode , Reg , RegKind ,
17+ ArgAbi , ArgAttribute , ArgAttributes , ArgExtension , Conv , FnAbi , PassMode , /* Reg, RegKind, */
1818} ;
1919use rustc_target:: abi:: * ;
2020use rustc_target:: spec:: { abi:: Abi as SpecAbi , HasTargetSpec , PanicStrategy , Target } ;
@@ -3340,16 +3340,16 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
33403340 Ok ( self . tcx . arena . alloc ( fn_abi) )
33413341 }
33423342
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- }
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+ // }
33533353
33543354 fn fn_abi_adjust_for_abi (
33553355 & self ,
@@ -3380,24 +3380,24 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
33803380
33813381 if arg. layout . is_unsized ( ) || size > max_by_val_size {
33823382 arg. make_indirect ( ) ;
3383- } else if self . has_all_float ( & arg. layout ) {
3384- // We don't want to aggregate floats as an aggregates of Integer
3385- // because this will hurt the generated assembly (#93490)
3386- //
3387- // As an optimization we want to pass homogeneous aggregate of floats
3388- // greater than pointer size as indirect
3389- if size > Pointer . size ( self ) {
3390- arg. make_indirect ( ) ;
3391- }
3392- } else {
3393- // We want to pass small aggregates as immediates, but using
3394- // a LLVM aggregate type for this leads to bad optimizations,
3395- // so we pick an appropriately sized integer type instead.
3396- //
3397- // NOTE: This is sub-optimal because in the case of (f32, f32, u32, u32)
3398- // we could do ([f32; 2], u64) which is better but this is the best we
3399- // can do right now.
3400- arg. cast_to ( Reg { kind : RegKind :: Integer , size } ) ;
3383+ // } else if self.has_all_float(&arg.layout) {
3384+ // // We don't want to aggregate floats as an aggregates of Integer
3385+ // // because this will hurt the generated assembly (#93490)
3386+ // //
3387+ // // As an optimization we want to pass homogeneous aggregate of floats
3388+ // // greater than pointer size as indirect
3389+ // if size > Pointer.size(self) {
3390+ // arg.make_indirect();
3391+ // }
3392+ // } else {
3393+ // // We want to pass small aggregates as immediates, but using
3394+ // // a LLVM aggregate type for this leads to bad optimizations,
3395+ // // so we pick an appropriately sized integer type instead.
3396+ // //
3397+ // // NOTE: This is sub-optimal because in the case of (f32, f32, u32, u32)
3398+ // // we could do ([f32; 2], u64) which is better but this is the best we
3399+ // // can do right now.
3400+ // arg.cast_to(Reg { kind: RegKind::Integer, size });
34013401 }
34023402 }
34033403
0 commit comments