@@ -10,9 +10,9 @@ use rustc_session::config::OptLevel;
1010use rustc_span:: { DUMMY_SP , Span } ;
1111use tracing:: { debug, instrument} ;
1212
13+ use super :: FunctionCx ;
1314use super :: operand:: { OperandRef , OperandValue } ;
1415use super :: place:: PlaceRef ;
15- use super :: { FunctionCx , LocalRef } ;
1616use crate :: common:: IntPredicate ;
1717use crate :: traits:: * ;
1818use crate :: { MemFlags , base} ;
@@ -593,14 +593,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
593593 self . codegen_place_to_pointer ( bx, place, mk_ptr)
594594 }
595595
596- mir:: Rvalue :: Len ( place) => {
597- let size = self . evaluate_array_len ( bx, place) ;
598- OperandRef {
599- val : OperandValue :: Immediate ( size) ,
600- layout : bx. cx ( ) . layout_of ( bx. tcx ( ) . types . usize ) ,
601- }
602- }
603-
604596 mir:: Rvalue :: BinaryOp ( op_with_overflow, box ( ref lhs, ref rhs) )
605597 if let Some ( op) = op_with_overflow. overflowing_to_wrapping ( ) =>
606598 {
@@ -800,24 +792,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
800792 }
801793 }
802794
803- fn evaluate_array_len ( & mut self , bx : & mut Bx , place : mir:: Place < ' tcx > ) -> Bx :: Value {
804- // ZST are passed as operands and require special handling
805- // because codegen_place() panics if Local is operand.
806- if let Some ( index) = place. as_local ( ) {
807- if let LocalRef :: Operand ( op) = self . locals [ index] {
808- if let ty:: Array ( _, n) = op. layout . ty . kind ( ) {
809- let n = n
810- . try_to_target_usize ( bx. tcx ( ) )
811- . expect ( "expected monomorphic const in codegen" ) ;
812- return bx. cx ( ) . const_usize ( n) ;
813- }
814- }
815- }
816- // use common size calculation for non zero-sized types
817- let cg_value = self . codegen_place ( bx, place. as_ref ( ) ) ;
818- cg_value. len ( bx. cx ( ) )
819- }
820-
821795 /// Codegen an `Rvalue::RawPtr` or `Rvalue::Ref`
822796 fn codegen_place_to_pointer (
823797 & mut self ,
@@ -1089,7 +1063,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
10891063 mir:: Rvalue :: Ref ( ..) |
10901064 mir:: Rvalue :: CopyForDeref ( ..) |
10911065 mir:: Rvalue :: RawPtr ( ..) |
1092- mir:: Rvalue :: Len ( ..) |
10931066 mir:: Rvalue :: Cast ( ..) | // (*)
10941067 mir:: Rvalue :: ShallowInitBox ( ..) | // (*)
10951068 mir:: Rvalue :: BinaryOp ( ..) |
0 commit comments