@@ -30,7 +30,7 @@ pub struct CrateCoverageContext<'ll, 'tcx> {
3030 pub ( crate ) function_coverage_map :
3131 RefCell < FxIndexMap < Instance < ' tcx > , FunctionCoverageCollector < ' tcx > > > ,
3232 pub ( crate ) pgo_func_name_var_map : RefCell < FxHashMap < Instance < ' tcx > , & ' ll llvm:: Value > > ,
33- pub ( crate ) mcdc_condition_bitmap_map : RefCell < FxHashMap < Instance < ' tcx > , & ' ll llvm:: Value > > ,
33+ pub ( crate ) mcdc_condition_bitmap_map : RefCell < FxHashMap < Instance < ' tcx > , Vec < & ' ll llvm:: Value > > > ,
3434}
3535
3636impl < ' ll , ' tcx > CrateCoverageContext < ' ll , ' tcx > {
@@ -50,8 +50,11 @@ impl<'ll, 'tcx> CrateCoverageContext<'ll, 'tcx> {
5050
5151 /// LLVM use a temp value to record evaluated mcdc test vector of each decision, which is called condition bitmap.
5252 /// This value is named `mcdc.addr` (same as clang) and is a 32-bit integer.
53- fn try_get_mcdc_condition_bitmap ( & self , instance : & Instance < ' tcx > ) -> Option < & ' ll llvm:: Value > {
54- self . mcdc_condition_bitmap_map . borrow ( ) . get ( instance) . copied ( )
53+ fn try_get_mcdc_condition_bitmap (
54+ & self ,
55+ instance : & Instance < ' tcx > ,
56+ ) -> Option < Vec < & ' ll llvm:: Value > > {
57+ self . mcdc_condition_bitmap_map . borrow ( ) . get ( instance) . cloned ( )
5558 }
5659}
5760
@@ -150,9 +153,11 @@ impl<'tcx> CoverageInfoBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> {
150153 0 ,
151154 "ConditionId of evaluated conditions should never be zero"
152155 ) ;
153- let cond_bitmap = coverage_context
156+ let cond_bitmaps = coverage_context
154157 . try_get_mcdc_condition_bitmap ( & instance)
155158 . expect ( "mcdc cond bitmap should have been allocated for updating" ) ;
159+ let cond_bitmap =
160+ cond_bitmaps. get ( 0 ) . expect ( "no mcdc cond bitmap with the given depth" ) ;
156161 let cond_loc = bx. const_i32 ( id. as_u32 ( ) as i32 - 1 ) ;
157162 let bool_value = bx. const_bool ( value) ;
158163 let fn_name = bx. get_pgo_func_name_var ( instance) ;
@@ -161,9 +166,11 @@ impl<'tcx> CoverageInfoBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> {
161166 }
162167 CoverageKind :: TestVectorBitmapUpdate { bitmap_idx } => {
163168 drop ( coverage_map) ;
164- let cond_bitmap = coverage_context
169+ let cond_bitmaps = coverage_context
165170 . try_get_mcdc_condition_bitmap ( & instance)
166171 . expect ( "mcdc cond bitmap should have been allocated for merging into the global bitmap" ) ;
172+ let cond_bitmap =
173+ cond_bitmaps. get ( 0 ) . expect ( "no mcdc cond bitmap with the given depth" ) ;
167174 let bitmap_bytes = bx. tcx ( ) . coverage_ids_info ( instance. def ) . mcdc_bitmap_bytes ;
168175 assert ! ( bitmap_idx < bitmap_bytes, "bitmap index of the decision out of range" ) ;
169176 assert ! (
@@ -195,7 +202,7 @@ fn ensure_mcdc_parameters<'ll, 'tcx>(
195202 let fn_name = bx. get_pgo_func_name_var ( instance) ;
196203 let hash = bx. const_u64 ( function_coverage_info. function_source_hash ) ;
197204 let bitmap_bytes = bx. const_u32 ( function_coverage_info. mcdc_bitmap_bytes ) ;
198- let cond_bitmap = bx. mcdc_parameters ( fn_name, hash, bitmap_bytes) ;
205+ let cond_bitmap = bx. mcdc_parameters ( fn_name, hash, bitmap_bytes, 1_u32 ) ;
199206 bx. coverage_context ( )
200207 . expect ( "already checked above" )
201208 . mcdc_condition_bitmap_map
0 commit comments