coverage: `CoverageIdsInfo::mcdc_bitmap_bytes` is never needed · rust-lang/rust@bfadc3a

File tree

3 files changed

lines changed

    • rustc_codegen_llvm/src/coverageinfo

    • rustc_mir_transform/src/coverage

3 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -207,13 +207,8 @@ impl<'tcx> CoverageInfoBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> {

207207

let cond_bitmap = coverage_context

208208

.try_get_mcdc_condition_bitmap(&instance, decision_depth)

209209

.expect("mcdc cond bitmap should have been allocated for merging into the global bitmap");

210-

let bitmap_bytes = bx.tcx().coverage_ids_info(instance.def).mcdc_bitmap_bytes;

210+

let bitmap_bytes = function_coverage_info.mcdc_bitmap_bytes;

211211

assert!(bitmap_idx < bitmap_bytes, "bitmap index of the decision out of range");

212-

assert!(

213-

bitmap_bytes <= function_coverage_info.mcdc_bitmap_bytes,

214-

"bitmap length disagreement: query says {bitmap_bytes} but function info only has {}",

215-

function_coverage_info.mcdc_bitmap_bytes

216-

);

217212
218213

let fn_name = bx.get_pgo_func_name_var(instance);

219214

let hash = bx.const_u64(function_coverage_info.function_source_hash);

Original file line numberDiff line numberDiff line change

@@ -362,8 +362,4 @@ pub struct CoverageIdsInfo {

362362

/// InstrumentCoverage MIR pass, if the highest-numbered counter increments

363363

/// were removed by MIR optimizations.

364364

pub max_counter_id: mir::coverage::CounterId,

365-
366-

/// Coverage codegen for mcdc needs to know the size of the global bitmap so that it can

367-

/// set the `bytemap-bytes` argument of the `llvm.instrprof.mcdc.tvbitmap.update` intrinsic.

368-

pub mcdc_bitmap_bytes: u32,

369365

}

Original file line numberDiff line numberDiff line change

@@ -61,17 +61,7 @@ fn coverage_ids_info<'tcx>(

6161

.max()

6262

.unwrap_or(CounterId::ZERO);

6363
64-

let mcdc_bitmap_bytes = mir_body

65-

.coverage_branch_info

66-

.as_deref()

67-

.map(|info| {

68-

info.mcdc_decision_spans

69-

.iter()

70-

.fold(0, |acc, decision| acc + (1_u32 << decision.conditions_num).div_ceil(8))

71-

})

72-

.unwrap_or_default();

73-
74-

CoverageIdsInfo { max_counter_id, mcdc_bitmap_bytes }

64+

CoverageIdsInfo { max_counter_id }

7565

}

7666
7767

fn all_coverage_in_mir_body<'a, 'tcx>(