@@ -165,14 +165,6 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
165165 let llval = bx. scalar_to_backend ( x, scalar, bx. immediate_backend_type ( layout) ) ;
166166 OperandValue :: Immediate ( llval)
167167 }
168- mir:: ConstValue :: RuntimeChecks ( checks) => {
169- let BackendRepr :: Scalar ( scalar) = layout. backend_repr else {
170- bug ! ( "from_const: invalid ByVal layout: {:#?}" , layout) ;
171- } ;
172- let x = Scalar :: from_bool ( checks. value ( bx. tcx ( ) . sess ) ) ;
173- let llval = bx. scalar_to_backend ( x, scalar, bx. immediate_backend_type ( layout) ) ;
174- OperandValue :: Immediate ( llval)
175- }
176168 ConstValue :: ZeroSized => return OperandRef :: zero_sized ( layout) ,
177169 ConstValue :: Slice { alloc_id, meta } => {
178170 let BackendRepr :: ScalarPair ( a_scalar, _) = layout. backend_repr else {
@@ -1060,6 +1052,17 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
10601052 OperandRef { move_annotation, ..self . codegen_consume ( bx, place. as_ref ( ) ) }
10611053 }
10621054
1055+ mir:: Operand :: RuntimeChecks ( checks) => {
1056+ let layout = bx. layout_of ( bx. tcx ( ) . types . bool ) ;
1057+ let BackendRepr :: Scalar ( scalar) = layout. backend_repr else {
1058+ bug ! ( "from_const: invalid ByVal layout: {:#?}" , layout) ;
1059+ } ;
1060+ let x = Scalar :: from_bool ( checks. value ( bx. tcx ( ) . sess ) ) ;
1061+ let llval = bx. scalar_to_backend ( x, scalar, bx. immediate_backend_type ( layout) ) ;
1062+ let val = OperandValue :: Immediate ( llval) ;
1063+ OperandRef { val, layout, move_annotation : None }
1064+ }
1065+
10631066 mir:: Operand :: Constant ( ref constant) => {
10641067 let constant_ty = self . monomorphize ( constant. ty ( ) ) ;
10651068 // Most SIMD vector constants should be passed as immediates.
0 commit comments