Skip to content

Commit

Permalink
coverage: Use a tracing span to group the parts of a sum-up expression
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalathar committed Oct 30, 2023
1 parent 2f1be08 commit 10c4734
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/rustc_mir_transform/src/coverage/counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,9 @@ impl<'a> MakeBcbCounters<'a> {
// counters and/or expressions of its incoming edges. This will recursively get or create
// counters for those incoming edges first, then call `make_expression()` to sum them up,
// with additional intermediate expressions as needed.
let _sumup_debug_span = debug_span!("(preparing sum-up expression)").entered();

let mut predecessors = self.bcb_predecessors(bcb).to_owned().into_iter();
debug!("{bcb:?} has multiple incoming edges and will need a sum-up expression");
let first_edge_counter_operand =
self.get_or_make_edge_counter_operand(predecessors.next().unwrap(), bcb)?;
let mut some_sumup_edge_counter_operand = None;
Expand All @@ -399,6 +400,8 @@ impl<'a> MakeBcbCounters<'a> {
Op::Add,
some_sumup_edge_counter_operand.unwrap(),
);
drop(_sumup_debug_span);

debug!("{bcb:?} gets a new counter (sum of predecessor counters): {counter_kind:?}");
self.coverage_counters.set_bcb_counter(bcb, counter_kind)
}
Expand Down

0 comments on commit 10c4734

Please sign in to comment.