@@ -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} ;
@@ -510,14 +510,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
510
510
self . codegen_place_to_pointer ( bx, place, mk_ptr)
511
511
}
512
512
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
-
521
513
mir:: Rvalue :: BinaryOp ( op_with_overflow, box ( ref lhs, ref rhs) )
522
514
if let Some ( op) = op_with_overflow. overflowing_to_wrapping ( ) =>
523
515
{
@@ -749,21 +741,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
749
741
}
750
742
}
751
743
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
-
767
744
/// Codegen an `Rvalue::RawPtr` or `Rvalue::Ref`
768
745
fn codegen_place_to_pointer (
769
746
& mut self ,
0 commit comments