@@ -256,14 +256,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
256256 OperandValue :: Immediate ( imm) ,
257257 abi:: BackendRepr :: Scalar ( from_scalar) ,
258258 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) ) ,
260260 (
261261 OperandValue :: Pair ( imm_a, imm_b) ,
262262 abi:: BackendRepr :: ScalarPair ( in_a, in_b) ,
263263 abi:: BackendRepr :: ScalarPair ( out_a, out_b) ,
264264 ) => 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) ,
267267 ) ,
268268 _ => return None ,
269269 } )
@@ -1017,12 +1017,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
10171017 }
10181018}
10191019
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`.
10221021///
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 > > (
10261028 bx : & mut Bx ,
10271029 mut imm : Bx :: Value ,
10281030 from_scalar : abi:: Scalar ,
@@ -1033,7 +1035,7 @@ pub(super) fn transmute_immediate<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
10331035 assert_ne ! (
10341036 bx. cx( ) . type_kind( imm_ty) ,
10351037 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:?}"
10371039 ) ;
10381040
10391041 // While optimizations will remove no-op transmutes, they might still be
0 commit comments