@@ -10,9 +10,9 @@ use rustc_session::config::OptLevel;
10
10
use rustc_span:: { DUMMY_SP , Span } ;
11
11
use tracing:: { debug, instrument} ;
12
12
13
+ use super :: FunctionCx ;
13
14
use super :: operand:: { OperandRef , OperandValue } ;
14
15
use super :: place:: PlaceRef ;
15
- use super :: { FunctionCx , LocalRef } ;
16
16
use crate :: common:: IntPredicate ;
17
17
use crate :: traits:: * ;
18
18
use crate :: { MemFlags , base} ;
@@ -593,14 +593,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
593
593
self . codegen_place_to_pointer ( bx, place, mk_ptr)
594
594
}
595
595
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
-
604
596
mir:: Rvalue :: BinaryOp ( op_with_overflow, box ( ref lhs, ref rhs) )
605
597
if let Some ( op) = op_with_overflow. overflowing_to_wrapping ( ) =>
606
598
{
@@ -800,24 +792,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
800
792
}
801
793
}
802
794
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
-
821
795
/// Codegen an `Rvalue::RawPtr` or `Rvalue::Ref`
822
796
fn codegen_place_to_pointer (
823
797
& mut self ,
@@ -1089,7 +1063,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1089
1063
mir:: Rvalue :: Ref ( ..) |
1090
1064
mir:: Rvalue :: CopyForDeref ( ..) |
1091
1065
mir:: Rvalue :: RawPtr ( ..) |
1092
- mir:: Rvalue :: Len ( ..) |
1093
1066
mir:: Rvalue :: Cast ( ..) | // (*)
1094
1067
mir:: Rvalue :: ShallowInitBox ( ..) | // (*)
1095
1068
mir:: Rvalue :: BinaryOp ( ..) |
0 commit comments