@@ -281,10 +281,8 @@ fn verify_func(tcx: TyCtxt<'_>, writer: &crate::pretty_clif::CommentWriter, func
281281}
282282
283283fn codegen_fn_body ( fx : & mut FunctionCx < ' _ , ' _ , ' _ > , start_block : Block ) {
284- let arg_uninhabited = fx
285- . mir
286- . args_iter ( )
287- . any ( |arg| fx. layout_of ( fx. monomorphize ( fx. mir . local_decls [ arg] . ty ) ) . is_uninhabited ( ) ) ;
284+ let arg_uninhabited =
285+ fx. mir . args_iter ( ) . any ( |arg| fx. layout_of ( fx. mir . local_decls [ arg] . ty ) . is_uninhabited ( ) ) ;
288286 if arg_uninhabited {
289287 fx. bcx . append_block_params_for_function_params ( fx. block_map [ START_BLOCK ] ) ;
290288 fx. bcx . switch_to_block ( fx. block_map [ START_BLOCK ] ) ;
@@ -688,8 +686,8 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
688686 ref operand,
689687 to_ty,
690688 ) => {
691- let from_ty = fx . monomorphize ( operand. ty ( & fx. mir . local_decls , fx. tcx ) ) ;
692- let to_layout = fx. layout_of ( fx . monomorphize ( to_ty) ) ;
689+ let from_ty = operand. ty ( & fx. mir . local_decls , fx. tcx ) ;
690+ let to_layout = fx. layout_of ( to_ty) ;
693691 match * from_ty. kind ( ) {
694692 ty:: FnDef ( def_id, args) => {
695693 let func_ref = fx. get_function_ref (
@@ -712,7 +710,7 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
712710 ref operand,
713711 to_ty,
714712 ) => {
715- let to_layout = fx. layout_of ( fx . monomorphize ( to_ty) ) ;
713+ let to_layout = fx. layout_of ( to_ty) ;
716714 let operand = codegen_operand ( fx, operand) ;
717715 lval. write_cvalue ( fx, operand. cast_pointer_to ( to_layout) ) ;
718716 }
@@ -742,7 +740,6 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
742740 ) => {
743741 let operand = codegen_operand ( fx, operand) ;
744742 let from_ty = operand. layout ( ) . ty ;
745- let to_ty = fx. monomorphize ( to_ty) ;
746743
747744 fn is_wide_ptr < ' tcx > ( fx : & FunctionCx < ' _ , ' _ , ' tcx > , ty : Ty < ' tcx > ) -> bool {
748745 ty. builtin_deref ( true ) . is_some_and ( |pointee_ty| {
@@ -814,8 +811,7 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
814811 }
815812 Rvalue :: Repeat ( ref operand, times) => {
816813 let operand = codegen_operand ( fx, operand) ;
817- let times = fx
818- . monomorphize ( times)
814+ let times = times
819815 . try_to_target_usize ( fx. tcx )
820816 . expect ( "expected monomorphic const in codegen" ) ;
821817 if operand. layout ( ) . size . bytes ( ) == 0 {
@@ -852,7 +848,7 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
852848 if matches ! ( * * kind, AggregateKind :: RawPtr ( ..) ) =>
853849 {
854850 let ty = to_place_and_rval. 1 . ty ( & fx. mir . local_decls , fx. tcx ) ;
855- let layout = fx. layout_of ( fx . monomorphize ( ty ) ) ;
851+ let layout = fx. layout_of ( ty ) ;
856852 let [ data, meta] = & * operands. raw else {
857853 bug ! ( "RawPtr fields: {operands:?}" ) ;
858854 } ;
@@ -947,8 +943,7 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
947943fn codegen_array_len < ' tcx > ( fx : & mut FunctionCx < ' _ , ' _ , ' tcx > , place : CPlace < ' tcx > ) -> Value {
948944 match * place. layout ( ) . ty . kind ( ) {
949945 ty:: Array ( _elem_ty, len) => {
950- let len = fx
951- . monomorphize ( len)
946+ let len = len
952947 . try_to_target_usize ( fx. tcx )
953948 . expect ( "expected monomorphic const in codegen" ) as i64 ;
954949 fx. bcx . ins ( ) . iconst ( fx. pointer_type , len)
@@ -971,7 +966,7 @@ pub(crate) fn codegen_place<'tcx>(
971966 }
972967 PlaceElem :: OpaqueCast ( ty) => bug ! ( "encountered OpaqueCast({ty}) in codegen" ) ,
973968 PlaceElem :: UnwrapUnsafeBinder ( ty) => {
974- cplace = cplace. place_transmute_type ( fx, fx . monomorphize ( ty ) ) ;
969+ cplace = cplace. place_transmute_type ( fx, ty ) ;
975970 }
976971 PlaceElem :: Field ( field, _ty) => {
977972 cplace = cplace. place_field ( fx, field) ;
0 commit comments