Skip to content

Commit 10cd5e8

Browse files
committed
coverage: Avoid referring to "operands" in counter creation
1 parent 8be70c7 commit 10cd5e8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

compiler/rustc_mir_transform/src/coverage/counters.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ impl<'a> MakeBcbCounters<'a> {
288288
) {
289289
// First, ensure that this node has a counter of some kind.
290290
// We might also use that counter to compute one of the out-edge counters.
291-
let from_bcb_operand = self.get_or_make_counter_operand(from_bcb);
291+
let node_counter = self.get_or_make_node_counter(from_bcb);
292292

293293
let successors = self.basic_coverage_blocks.successors[from_bcb].as_slice();
294294

@@ -324,7 +324,7 @@ impl<'a> MakeBcbCounters<'a> {
324324
.filter(|&to_bcb| to_bcb != expression_to_bcb)
325325
.fold(None, |accum, to_bcb| {
326326
let _span = debug_span!("to_bcb", ?accum, ?to_bcb).entered();
327-
let edge_counter = self.get_or_make_edge_counter_operand(from_bcb, to_bcb);
327+
let edge_counter = self.get_or_make_edge_counter(from_bcb, to_bcb);
328328
Some(self.coverage_counters.make_sum_expression(accum, edge_counter))
329329
})
330330
.expect("there must be at least one other out-edge")
@@ -333,7 +333,7 @@ impl<'a> MakeBcbCounters<'a> {
333333
// Now create an expression for the chosen edge, by taking the counter
334334
// for its source node and subtracting the sum of its sibling out-edges.
335335
let expression = self.coverage_counters.make_expression(
336-
from_bcb_operand,
336+
node_counter,
337337
Op::Subtract,
338338
sum_of_all_other_out_edges,
339339
);
@@ -347,7 +347,7 @@ impl<'a> MakeBcbCounters<'a> {
347347
}
348348

349349
#[instrument(level = "debug", skip(self))]
350-
fn get_or_make_counter_operand(&mut self, bcb: BasicCoverageBlock) -> BcbCounter {
350+
fn get_or_make_node_counter(&mut self, bcb: BasicCoverageBlock) -> BcbCounter {
351351
// If the BCB already has a counter, return it.
352352
if let Some(counter_kind) = self.coverage_counters.bcb_counters[bcb] {
353353
debug!("{bcb:?} already has a counter: {counter_kind:?}");
@@ -384,7 +384,7 @@ impl<'a> MakeBcbCounters<'a> {
384384
.copied()
385385
.fold(None, |accum, from_bcb| {
386386
let _span = debug_span!("from_bcb", ?accum, ?from_bcb).entered();
387-
let edge_counter = self.get_or_make_edge_counter_operand(from_bcb, bcb);
387+
let edge_counter = self.get_or_make_edge_counter(from_bcb, bcb);
388388
Some(self.coverage_counters.make_sum_expression(accum, edge_counter))
389389
})
390390
.expect("there must be at least one in-edge")
@@ -395,7 +395,7 @@ impl<'a> MakeBcbCounters<'a> {
395395
}
396396

397397
#[instrument(level = "debug", skip(self))]
398-
fn get_or_make_edge_counter_operand(
398+
fn get_or_make_edge_counter(
399399
&mut self,
400400
from_bcb: BasicCoverageBlock,
401401
to_bcb: BasicCoverageBlock,
@@ -404,13 +404,13 @@ impl<'a> MakeBcbCounters<'a> {
404404
// a node counter instead, since it will have the same value.
405405
if !self.basic_coverage_blocks.bcb_has_multiple_in_edges(to_bcb) {
406406
assert_eq!([from_bcb].as_slice(), self.basic_coverage_blocks.predecessors[to_bcb]);
407-
return self.get_or_make_counter_operand(to_bcb);
407+
return self.get_or_make_node_counter(to_bcb);
408408
}
409409

410410
// If the source BCB has only one successor (assumed to be the given target), an edge
411411
// counter is unnecessary. Just get or make a counter for the source BCB.
412412
if self.bcb_successors(from_bcb).len() == 1 {
413-
return self.get_or_make_counter_operand(from_bcb);
413+
return self.get_or_make_node_counter(from_bcb);
414414
}
415415

416416
// If the edge already has a counter, return it.

0 commit comments

Comments
 (0)