@@ -19,6 +19,7 @@ use rustc_codegen_ssa::mir::place::PlaceRef;
1919use rustc_codegen_ssa:: traits:: * ;
2020use rustc_codegen_ssa:: MemFlags ;
2121use rustc_hir as hir;
22+ use rustc_middle:: mir:: coverage;
2223use rustc_middle:: ty:: layout:: { FnAbiExt , HasTyCtxt } ;
2324use rustc_middle:: ty:: { self , Ty } ;
2425use rustc_middle:: { bug, span_bug} ;
@@ -140,27 +141,24 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {
140141 self . call ( llfn, & [ ] , None )
141142 }
142143 "count_code_region" => {
143- use rustc_middle:: mir:: count_code_region_args:: {
144- COUNTER_INDEX , END_BYTE_POS , START_BYTE_POS ,
145- } ;
144+ use coverage:: count_code_region_args:: * ;
146145 // FIXME(richkadel): The current implementation assumes the MIR for the given
147146 // caller_instance represents a single function. Validate and/or correct if inlining
148147 // and/or monomorphization invalidates these assumptions.
149- let coverage_data = tcx. coverage_data ( caller_instance. def_id ( ) ) ;
148+ let coverageinfo = tcx. coverageinfo ( caller_instance. def_id ( ) ) ;
150149 let mangled_fn = tcx. symbol_name ( caller_instance) ;
151150 let ( mangled_fn_name, _len_val) = self . const_str ( mangled_fn. name ) ;
152- let hash = self . const_u64 ( coverage_data . hash ) ;
153- let num_counters = self . const_u32 ( coverage_data . num_counters ) ;
151+ let hash = self . const_u64 ( coverageinfo . hash ) ;
152+ let num_counters = self . const_u32 ( coverageinfo . num_counters ) ;
154153 let index = args[ COUNTER_INDEX ] . immediate ( ) ;
155154 debug ! (
156- "count_code_region to LLVM intrinsic instrprof.increment(fn_name={}, hash={:?}, num_counters={:?}, index={:?}), byte range {:?}..{:?}, coverage_regions: {:?} " ,
155+ "count_code_region to LLVM intrinsic instrprof.increment(fn_name={}, hash={:?}, num_counters={:?}, index={:?}), byte range {:?}..{:?}" ,
157156 mangled_fn. name,
158157 hash,
159158 num_counters,
160159 index,
161160 args[ START_BYTE_POS ] . immediate( ) ,
162161 args[ END_BYTE_POS ] . immediate( ) ,
163- coverage_data. coverage_regions,
164162 ) ;
165163 self . instrprof_increment ( mangled_fn_name, hash, num_counters, index)
166164 }
0 commit comments