@@ -56,10 +56,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
5656 let dest = this. project_index ( & dest, i) ?;
5757
5858 // Widen the operands to avoid overflow
59- let twice_wide_ty = this. get_twice_wide_int_ty ( left. layout . ty ) ;
60- let twice_wide_layout = this. layout_of ( twice_wide_ty) ?;
61- let left = this. int_to_int_or_float ( & left, twice_wide_ty) ?;
62- let right = this. int_to_int_or_float ( & right, twice_wide_ty) ?;
59+ let twice_wide = this. layout_of ( this. get_twice_wide_int_ty ( left. layout . ty ) ) ?;
60+ let left = this. int_to_int_or_float ( & left, twice_wide) ?;
61+ let right = this. int_to_int_or_float ( & right, twice_wide) ?;
6362
6463 // Calculate left + right + 1
6564 let added = this. wrapping_binary_op (
@@ -70,20 +69,20 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
7069 let added = this. wrapping_binary_op (
7170 mir:: BinOp :: Add ,
7271 & added,
73- & ImmTy :: from_uint ( 1u32 , twice_wide_layout ) ,
72+ & ImmTy :: from_uint ( 1u32 , twice_wide ) ,
7473 ) ?;
7574
7675 // Calculate (left + right + 1) / 2
7776 let divided = this. wrapping_binary_op (
7877 mir:: BinOp :: Div ,
7978 & added,
80- & ImmTy :: from_uint ( 2u32 , twice_wide_layout ) ,
79+ & ImmTy :: from_uint ( 2u32 , twice_wide ) ,
8180 ) ?;
8281
8382 // Narrow back to the original type
8483 let res = this. int_to_int_or_float (
8584 & divided,
86- dest. layout . ty ,
85+ dest. layout ,
8786 ) ?;
8887 this. write_immediate ( * res, & dest) ?;
8988 }
@@ -106,10 +105,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
106105 let dest = this. project_index ( & dest, i) ?;
107106
108107 // Widen the operands to avoid overflow
109- let twice_wide_ty = this. get_twice_wide_int_ty ( left. layout . ty ) ;
110- let twice_wide_layout = this. layout_of ( twice_wide_ty) ?;
111- let left = this. int_to_int_or_float ( & left, twice_wide_ty) ?;
112- let right = this. int_to_int_or_float ( & right, twice_wide_ty) ?;
108+ let twice_wide = this. layout_of ( this. get_twice_wide_int_ty ( left. layout . ty ) ) ?;
109+ let left = this. int_to_int_or_float ( & left, twice_wide) ?;
110+ let right = this. int_to_int_or_float ( & right, twice_wide) ?;
113111
114112 // Multiply
115113 let multiplied = this. wrapping_binary_op (
@@ -121,13 +119,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
121119 let high = this. wrapping_binary_op (
122120 mir:: BinOp :: Shr ,
123121 & multiplied,
124- & ImmTy :: from_uint ( dest. layout . size . bits ( ) , twice_wide_layout ) ,
122+ & ImmTy :: from_uint ( dest. layout . size . bits ( ) , twice_wide ) ,
125123 ) ?;
126124
127125 // Narrow back to the original type
128126 let res = this. int_to_int_or_float (
129127 & high,
130- dest. layout . ty ,
128+ dest. layout ,
131129 ) ?;
132130 this. write_immediate ( * res, & dest) ?;
133131 }
@@ -392,7 +390,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
392390 let dest = this. project_index ( & dest, i) ?;
393391
394392 let res =
395- this. float_to_int_checked ( op, dest. layout . ty , rnd) . unwrap_or_else ( || {
393+ this. float_to_int_checked ( op, dest. layout , rnd) . unwrap_or_else ( || {
396394 // Fallback to minimum acording to SSE2 semantics.
397395 ImmTy :: from_int ( i32:: MIN , this. machine . layouts . i32 )
398396 } ) ;
@@ -648,7 +646,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
648646 let op = this. read_immediate ( & this. project_index ( & op, i) ?) ?;
649647 let dest = this. project_index ( & dest, i) ?;
650648
651- let res = this. float_to_float_or_int ( & op, dest. layout . ty ) ?;
649+ let res = this. float_to_float_or_int ( & op, dest. layout ) ?;
652650 this. write_immediate ( * res, & dest) ?;
653651 }
654652 // For f32 -> f64, ignore the remaining
@@ -685,7 +683,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
685683 let dest = this. project_index ( & dest, i) ?;
686684
687685 let res =
688- this. float_to_int_checked ( op, dest. layout . ty , rnd) . unwrap_or_else ( || {
686+ this. float_to_int_checked ( op, dest. layout , rnd) . unwrap_or_else ( || {
689687 // Fallback to minimum acording to SSE2 semantics.
690688 ImmTy :: from_int ( i32:: MIN , this. machine . layouts . i32 )
691689 } ) ;
@@ -716,7 +714,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
716714 _ => unreachable ! ( ) ,
717715 } ;
718716
719- let res = this. float_to_int_checked ( op, dest. layout . ty , rnd) . unwrap_or_else ( || {
717+ let res = this. float_to_int_checked ( op, dest. layout , rnd) . unwrap_or_else ( || {
720718 // Fallback to minimum acording to SSE semantics.
721719 ImmTy :: from_int ( dest. layout . size . signed_int_min ( ) , dest. layout )
722720 } ) ;
@@ -741,7 +739,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
741739 let dest0 = this. project_index ( & dest, 0 ) ?;
742740 // `float_to_float_or_int` here will convert from f64 to f32 (cvtsd2ss) or
743741 // from f32 to f64 (cvtss2sd).
744- let res0 = this. float_to_float_or_int ( & right0, dest0. layout . ty ) ?;
742+ let res0 = this. float_to_float_or_int ( & right0, dest0. layout ) ?;
745743 this. write_immediate ( * res0, & dest0) ?;
746744
747745 // Copy remianing from `left`
0 commit comments