Rust coverage before splitting instrument_coverage.rs
This commit is contained in:
parent
9d78d1d027
commit
c7747cc772
214 changed files with 9845 additions and 1267 deletions
|
@ -10,7 +10,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
let Coverage { kind, code_region } = coverage;
|
||||
match kind {
|
||||
CoverageKind::Counter { function_source_hash, id } => {
|
||||
if bx.add_counter_region(self.instance, function_source_hash, id, code_region) {
|
||||
let covmap_updated = if let Some(code_region) = code_region {
|
||||
// Note: Some counters do not have code regions, but may still be referenced from
|
||||
// expressions.
|
||||
bx.add_coverage_counter(self.instance, function_source_hash, id, code_region)
|
||||
} else {
|
||||
bx.set_function_source_hash(self.instance, function_source_hash)
|
||||
};
|
||||
|
||||
if covmap_updated {
|
||||
let coverageinfo = bx.tcx().coverageinfo(self.instance.def_id());
|
||||
|
||||
let fn_name = bx.create_pgo_func_name_var(self.instance);
|
||||
|
@ -21,14 +29,17 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
"codegen intrinsic instrprof.increment(fn_name={:?}, hash={:?}, num_counters={:?}, index={:?})",
|
||||
fn_name, hash, num_counters, id,
|
||||
);
|
||||
bx.instrprof_increment(fn_name, hash, num_counters, id);
|
||||
bx.instrprof_increment(fn_name, hash, num_counters, index);
|
||||
}
|
||||
}
|
||||
CoverageKind::Expression { id, lhs, op, rhs } => {
|
||||
bx.add_counter_expression_region(self.instance, id, lhs, op, rhs, code_region);
|
||||
bx.add_coverage_counter_expression(self.instance, id, lhs, op, rhs, code_region);
|
||||
}
|
||||
CoverageKind::Unreachable => {
|
||||
bx.add_unreachable_region(self.instance, code_region);
|
||||
bx.add_coverage_unreachable(
|
||||
self.instance,
|
||||
code_region.expect("unreachable regions always have code regions"),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue