@@ -256,14 +256,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
256
256
OperandValue :: Immediate ( imm) ,
257
257
abi:: BackendRepr :: Scalar ( from_scalar) ,
258
258
abi:: BackendRepr :: Scalar ( to_scalar) ,
259
- ) => OperandValue :: Immediate ( transmute_immediate ( bx, imm, from_scalar, to_scalar) ) ,
259
+ ) => OperandValue :: Immediate ( transmute_scalar ( bx, imm, from_scalar, to_scalar) ) ,
260
260
(
261
261
OperandValue :: Pair ( imm_a, imm_b) ,
262
262
abi:: BackendRepr :: ScalarPair ( in_a, in_b) ,
263
263
abi:: BackendRepr :: ScalarPair ( out_a, out_b) ,
264
264
) => OperandValue :: Pair (
265
- transmute_immediate ( bx, imm_a, in_a, out_a) ,
266
- transmute_immediate ( bx, imm_b, in_b, out_b) ,
265
+ transmute_scalar ( bx, imm_a, in_a, out_a) ,
266
+ transmute_scalar ( bx, imm_b, in_b, out_b) ,
267
267
) ,
268
268
_ => return None ,
269
269
} )
@@ -1017,12 +1017,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1017
1017
}
1018
1018
}
1019
1019
1020
- /// Transmutes one of the immediates from an [`OperandValue::Immediate`]
1021
- /// or an [`OperandValue::Pair`] to an immediate of the target type.
1020
+ /// Transmutes a single scalar value `imm` from `from_scalar` to `to_scalar`.
1022
1021
///
1023
- /// `to_backend_ty` must be the *non*-immediate backend type (so it will be
1024
- /// `i8`, not `i1`, for `bool`-like types.)
1025
- pub ( super ) fn transmute_immediate < ' a , ' tcx , Bx : BuilderMethods < ' a , ' tcx > > (
1022
+ /// This is expected to be in *immediate* form, as seen in [`OperandValue::Immediate`]
1023
+ /// or [`OperandValue::Pair`] (so `i1` for bools, not `i8`, for example).
1024
+ ///
1025
+ /// ICEs if the passed-in `imm` is not a value of the expected type for
1026
+ /// `from_scalar`, such as if it's a vector or a pair.
1027
+ pub ( super ) fn transmute_scalar < ' a , ' tcx , Bx : BuilderMethods < ' a , ' tcx > > (
1026
1028
bx : & mut Bx ,
1027
1029
mut imm : Bx :: Value ,
1028
1030
from_scalar : abi:: Scalar ,
@@ -1033,7 +1035,7 @@ pub(super) fn transmute_immediate<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
1033
1035
assert_ne ! (
1034
1036
bx. cx( ) . type_kind( imm_ty) ,
1035
1037
TypeKind :: Vector ,
1036
- "Vector type {imm_ty:?} not allowed in transmute_immediate {from_scalar:?} -> {to_scalar:?}"
1038
+ "Vector type {imm_ty:?} not allowed in transmute_scalar {from_scalar:?} -> {to_scalar:?}"
1037
1039
) ;
1038
1040
1039
1041
// While optimizations will remove no-op transmutes, they might still be
0 commit comments