@@ -228,9 +228,7 @@ impl<'a> MakeBcbCounters<'a> {
228
228
debug ! ( "{:?} has at least one coverage span. Get or make its counter" , bcb) ;
229
229
let branching_counter_operand = self . get_or_make_counter_operand ( bcb) ;
230
230
231
- if self . bcb_needs_branch_counters ( bcb) {
232
- self . make_branch_counters ( & traversal, bcb, branching_counter_operand) ;
233
- }
231
+ self . make_branch_counters ( & traversal, bcb, branching_counter_operand) ;
234
232
} else {
235
233
debug ! (
236
234
"{:?} does not have any coverage spans. A counter will only be added if \
@@ -254,6 +252,15 @@ impl<'a> MakeBcbCounters<'a> {
254
252
branching_counter_operand : CovTerm ,
255
253
) {
256
254
let branches = self . bcb_branches ( from_bcb) ;
255
+
256
+ // If this node doesn't have multiple out-edges, or all of its out-edges
257
+ // already have counters, then we don't need to create edge counters.
258
+ let needs_branch_counters =
259
+ branches. len ( ) > 1 && branches. iter ( ) . any ( |branch| self . branch_has_no_counter ( branch) ) ;
260
+ if !needs_branch_counters {
261
+ return ;
262
+ }
263
+
257
264
debug ! (
258
265
"{from_bcb:?} has some branch(es) without counters:\n {}" ,
259
266
branches
@@ -510,12 +517,6 @@ impl<'a> MakeBcbCounters<'a> {
510
517
. collect :: < Vec < _ > > ( )
511
518
}
512
519
513
- fn bcb_needs_branch_counters ( & self , bcb : BasicCoverageBlock ) -> bool {
514
- let branch_needs_a_counter = |branch : & BcbBranch | self . branch_has_no_counter ( branch) ;
515
- let branches = self . bcb_branches ( bcb) ;
516
- branches. len ( ) > 1 && branches. iter ( ) . any ( branch_needs_a_counter)
517
- }
518
-
519
520
fn branch_has_no_counter ( & self , branch : & BcbBranch ) -> bool {
520
521
self . branch_counter ( branch) . is_none ( )
521
522
}
0 commit comments