@@ -180,7 +180,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
180
180
}
181
181
182
182
_ => {
183
- assert ! ( self . rvalue_creates_operand( rvalue) ) ;
184
183
let temp = self . codegen_rvalue_operand ( bx, rvalue) ;
185
184
temp. val . store ( bx, dest) ;
186
185
}
@@ -218,11 +217,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
218
217
219
218
/// Transmutes an `OperandValue` to another `OperandValue`.
220
219
///
221
- /// This is supported only for cases where [`Self::rvalue_creates_operand`]
222
- /// returns `true`, and will ICE otherwise. (In particular, anything that
223
- /// would need to `alloca` in order to return a `PlaceValue` will ICE,
224
- /// expecting those to go via [`Self::codegen_transmute`] instead where
225
- /// the destination place is already allocated.)
220
+ /// This is supported for all cases where the `cast` type is SSA,
221
+ /// but for non-ZSTs with [`abi::BackendRepr::Memory`] it ICEs.
226
222
pub ( crate ) fn codegen_transmute_operand (
227
223
& mut self ,
228
224
bx : & mut Bx ,
@@ -379,8 +375,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
379
375
bx : & mut Bx ,
380
376
rvalue : & mir:: Rvalue < ' tcx > ,
381
377
) -> OperandRef < ' tcx , Bx :: Value > {
382
- assert ! ( self . rvalue_creates_operand( rvalue) , "cannot codegen {rvalue:?} to operand" , ) ;
383
-
384
378
match * rvalue {
385
379
mir:: Rvalue :: Cast ( ref kind, ref source, mir_cast_ty) => {
386
380
let operand = self . codegen_operand ( bx, source) ;
@@ -706,8 +700,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
706
700
let ty = self . monomorphize ( ty) ;
707
701
let layout = self . cx . layout_of ( ty) ;
708
702
709
- // `rvalue_creates_operand` has arranged that we only get here if
710
- // we can build the aggregate immediate from the field immediates.
711
703
let mut builder = OperandRefBuilder :: new ( layout) ;
712
704
for ( field_idx, field) in fields. iter_enumerated ( ) {
713
705
let op = self . codegen_operand ( bx, field) ;
@@ -1008,38 +1000,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1008
1000
1009
1001
OperandValue :: Pair ( val, of)
1010
1002
}
1011
-
1012
- /// Returns `true` if the `rvalue` can be computed into an [`OperandRef`],
1013
- /// rather than needing a full `PlaceRef` for the assignment destination.
1014
- ///
1015
- /// This is used by the [`super::analyze`] code to decide which MIR locals
1016
- /// can stay as SSA values (as opposed to generating `alloca` slots for them).
1017
- /// As such, some paths here return `true` even where the specific rvalue
1018
- /// will not actually take the operand path because the result type is such
1019
- /// that it always gets an `alloca`, but where it's not worth re-checking the
1020
- /// layout in this code when the right thing will happen anyway.
1021
- pub ( crate ) fn rvalue_creates_operand ( & self , rvalue : & mir:: Rvalue < ' tcx > ) -> bool {
1022
- match * rvalue {
1023
- mir:: Rvalue :: Ref ( ..) |
1024
- mir:: Rvalue :: CopyForDeref ( ..) |
1025
- mir:: Rvalue :: RawPtr ( ..) |
1026
- mir:: Rvalue :: Len ( ..) |
1027
- mir:: Rvalue :: Cast ( ..) | // (*)
1028
- mir:: Rvalue :: ShallowInitBox ( ..) | // (*)
1029
- mir:: Rvalue :: BinaryOp ( ..) |
1030
- mir:: Rvalue :: UnaryOp ( ..) |
1031
- mir:: Rvalue :: Discriminant ( ..) |
1032
- mir:: Rvalue :: NullaryOp ( ..) |
1033
- mir:: Rvalue :: ThreadLocalRef ( _) |
1034
- mir:: Rvalue :: Use ( ..) |
1035
- mir:: Rvalue :: Repeat ( ..) | // (*)
1036
- mir:: Rvalue :: Aggregate ( ..) | // (*)
1037
- mir:: Rvalue :: WrapUnsafeBinder ( ..) => // (*)
1038
- true ,
1039
- }
1040
-
1041
- // (*) this is only true if the type is suitable
1042
- }
1043
1003
}
1044
1004
1045
1005
/// Transmutes a single scalar value `imm` from `from_scalar` to `to_scalar`.
0 commit comments