File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,10 +8,10 @@ use rustc_ast::InlineAsmOptions;
88use rustc_codegen_ssa:: base:: is_call_from_compiler_builtins_to_upstream_monomorphization;
99use rustc_data_structures:: profiling:: SelfProfilerRef ;
1010use rustc_index:: IndexVec ;
11- use rustc_middle:: ty:: TypeVisitableExt ;
1211use rustc_middle:: ty:: adjustment:: PointerCoercion ;
1312use rustc_middle:: ty:: layout:: FnAbiOf ;
1413use rustc_middle:: ty:: print:: with_no_trimmed_paths;
14+ use rustc_middle:: ty:: { ScalarInt , TypeVisitableExt } ;
1515use rustc_session:: config:: OutputFilenames ;
1616use rustc_span:: Symbol ;
1717
@@ -1039,6 +1039,12 @@ pub(crate) fn codegen_operand<'tcx>(
10391039 cplace. to_cvalue ( fx)
10401040 }
10411041 Operand :: Constant ( const_) => crate :: constant:: codegen_constant_operand ( fx, const_) ,
1042+ Operand :: RuntimeChecks ( checks) => {
1043+ let int = checks. value ( fx. tcx . sess ) ;
1044+ let int = ScalarInt :: try_from_uint ( int, Size :: from_bits ( 1 ) ) . unwrap ( ) ;
1045+ let layout = fx. layout_of ( fx. tcx . types . bool ) ;
1046+ return CValue :: const_val ( fx, layout, int) ;
1047+ }
10421048 }
10431049}
10441050
Original file line number Diff line number Diff line change @@ -215,11 +215,6 @@ pub(crate) fn codegen_const_value<'tcx>(
215215 CValue :: by_val ( val, layout)
216216 }
217217 } ,
218- ConstValue :: RuntimeChecks ( checks) => {
219- let int = checks. value ( fx. tcx . sess ) ;
220- let int = ScalarInt :: try_from_uint ( int, Size :: from_bits ( 1 ) ) . unwrap ( ) ;
221- return CValue :: const_val ( fx, layout, int) ;
222- }
223218 ConstValue :: Indirect { alloc_id, offset } => CValue :: by_ref (
224219 Pointer :: new ( pointer_for_allocation ( fx, alloc_id) )
225220 . offset_i64 ( fx, i64:: try_from ( offset. bytes ( ) ) . unwrap ( ) ) ,
@@ -545,6 +540,10 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
545540 operand : & Operand < ' tcx > ,
546541) -> Option < ScalarInt > {
547542 match operand {
543+ Operand :: RuntimeChecks ( checks) => {
544+ let int = checks. value ( fx. tcx . sess ) ;
545+ ScalarInt :: try_from_uint ( int, Size :: from_bits ( 1 ) )
546+ }
548547 Operand :: Constant ( const_) => eval_mir_constant ( fx, const_) . 0 . try_to_scalar_int ( ) ,
549548 // FIXME(rust-lang/rust#85105): Casts like `IMM8 as u32` result in the const being stored
550549 // inside a temporary before being passed to the intrinsic requiring the const argument.
You can’t perform that action at this time.
0 commit comments