@@ -7,9 +7,9 @@ use rustc_middle::{bug, mir, span_bug};
77use rustc_session:: config:: OptLevel ;
88use tracing:: { debug, instrument} ;
99
10+ use super :: FunctionCx ;
1011use super :: operand:: { OperandRef , OperandRefBuilder , OperandValue } ;
1112use super :: place:: { PlaceRef , PlaceValue , codegen_tag_value} ;
12- use super :: { FunctionCx , LocalRef } ;
1313use crate :: common:: { IntPredicate , TypeKind } ;
1414use crate :: traits:: * ;
1515use crate :: { MemFlags , base} ;
@@ -510,14 +510,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
510510 self . codegen_place_to_pointer ( bx, place, mk_ptr)
511511 }
512512
513- mir:: Rvalue :: Len ( place) => {
514- let size = self . evaluate_array_len ( bx, place) ;
515- OperandRef {
516- val : OperandValue :: Immediate ( size) ,
517- layout : bx. cx ( ) . layout_of ( bx. tcx ( ) . types . usize ) ,
518- }
519- }
520-
521513 mir:: Rvalue :: BinaryOp ( op_with_overflow, box ( ref lhs, ref rhs) )
522514 if let Some ( op) = op_with_overflow. overflowing_to_wrapping ( ) =>
523515 {
@@ -749,21 +741,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
749741 }
750742 }
751743
752- fn evaluate_array_len ( & mut self , bx : & mut Bx , place : mir:: Place < ' tcx > ) -> Bx :: Value {
753- // ZST are passed as operands and require special handling
754- // because codegen_place() panics if Local is operand.
755- if let Some ( index) = place. as_local ( )
756- && let LocalRef :: Operand ( op) = self . locals [ index]
757- && let ty:: Array ( _, n) = op. layout . ty . kind ( )
758- {
759- let n = n. try_to_target_usize ( bx. tcx ( ) ) . expect ( "expected monomorphic const in codegen" ) ;
760- return bx. cx ( ) . const_usize ( n) ;
761- }
762- // use common size calculation for non zero-sized types
763- let cg_value = self . codegen_place ( bx, place. as_ref ( ) ) ;
764- cg_value. len ( bx. cx ( ) )
765- }
766-
767744 /// Codegen an `Rvalue::RawPtr` or `Rvalue::Ref`
768745 fn codegen_place_to_pointer (
769746 & mut self ,
0 commit comments