@@ -7,9 +7,9 @@ use rustc_middle::{bug, mir, span_bug};
7
7
use rustc_session:: config:: OptLevel ;
8
8
use tracing:: { debug, instrument} ;
9
9
10
+ use super :: FunctionCx ;
10
11
use super :: operand:: { OperandRef , OperandRefBuilder , OperandValue } ;
11
12
use super :: place:: { PlaceRef , PlaceValue , codegen_tag_value} ;
12
- use super :: { FunctionCx , LocalRef } ;
13
13
use crate :: common:: { IntPredicate , TypeKind } ;
14
14
use crate :: traits:: * ;
15
15
use crate :: { MemFlags , base} ;
@@ -501,14 +501,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
501
501
self . codegen_place_to_pointer ( bx, place, mk_ptr)
502
502
}
503
503
504
- mir:: Rvalue :: Len ( place) => {
505
- let size = self . evaluate_array_len ( bx, place) ;
506
- OperandRef {
507
- val : OperandValue :: Immediate ( size) ,
508
- layout : bx. cx ( ) . layout_of ( bx. tcx ( ) . types . usize ) ,
509
- }
510
- }
511
-
512
504
mir:: Rvalue :: BinaryOp ( op_with_overflow, box ( ref lhs, ref rhs) )
513
505
if let Some ( op) = op_with_overflow. overflowing_to_wrapping ( ) =>
514
506
{
@@ -740,21 +732,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
740
732
}
741
733
}
742
734
743
- fn evaluate_array_len ( & mut self , bx : & mut Bx , place : mir:: Place < ' tcx > ) -> Bx :: Value {
744
- // ZST are passed as operands and require special handling
745
- // because codegen_place() panics if Local is operand.
746
- if let Some ( index) = place. as_local ( )
747
- && let LocalRef :: Operand ( op) = self . locals [ index]
748
- && let ty:: Array ( _, n) = op. layout . ty . kind ( )
749
- {
750
- let n = n. try_to_target_usize ( bx. tcx ( ) ) . expect ( "expected monomorphic const in codegen" ) ;
751
- return bx. cx ( ) . const_usize ( n) ;
752
- }
753
- // use common size calculation for non zero-sized types
754
- let cg_value = self . codegen_place ( bx, place. as_ref ( ) ) ;
755
- cg_value. len ( bx. cx ( ) )
756
- }
757
-
758
735
/// Codegen an `Rvalue::RawPtr` or `Rvalue::Ref`
759
736
fn codegen_place_to_pointer (
760
737
& mut self ,
0 commit comments