11use rustc_data_structures:: captures:: Captures ;
22use rustc_data_structures:: fx:: FxHashMap ;
33use rustc_data_structures:: graph:: WithNumNodes ;
4- use rustc_index:: bit_set:: BitSet ;
54use rustc_index:: IndexVec ;
65use rustc_middle:: mir:: coverage:: * ;
76
@@ -18,10 +17,6 @@ pub(super) enum BcbCounter {
1817}
1918
2019impl BcbCounter {
21- fn is_expression ( & self ) -> bool {
22- matches ! ( self , Self :: Expression { .. } )
23- }
24-
2520 pub ( super ) fn as_term ( & self ) -> CovTerm {
2621 match * self {
2722 BcbCounter :: Counter { id, .. } => CovTerm :: Counter ( id) ,
@@ -60,10 +55,6 @@ pub(super) struct CoverageCounters {
6055 /// We currently don't iterate over this map, but if we do in the future,
6156 /// switch it back to `FxIndexMap` to avoid query stability hazards.
6257 bcb_edge_counters : FxHashMap < ( BasicCoverageBlock , BasicCoverageBlock ) , BcbCounter > ,
63- /// Tracks which BCBs have a counter associated with some incoming edge.
64- /// Only used by assertions, to verify that BCBs with incoming edge
65- /// counters do not have their own physical counters (expressions are allowed).
66- bcb_has_incoming_edge_counters : BitSet < BasicCoverageBlock > ,
6758 /// Table of expression data, associating each expression ID with its
6859 /// corresponding operator (+ or -) and its LHS/RHS operands.
6960 expressions : IndexVec < ExpressionId , Expression > ,
@@ -83,7 +74,6 @@ impl CoverageCounters {
8374 counter_increment_sites : IndexVec :: new ( ) ,
8475 bcb_counters : IndexVec :: from_elem_n ( None , num_bcbs) ,
8576 bcb_edge_counters : FxHashMap :: default ( ) ,
86- bcb_has_incoming_edge_counters : BitSet :: new_empty ( num_bcbs) ,
8777 expressions : IndexVec :: new ( ) ,
8878 } ;
8979
@@ -122,14 +112,6 @@ impl CoverageCounters {
122112 }
123113
124114 fn set_bcb_counter ( & mut self , bcb : BasicCoverageBlock , counter_kind : BcbCounter ) -> BcbCounter {
125- assert ! (
126- // If the BCB has an edge counter (to be injected into a new `BasicBlock`), it can also
127- // have an expression (to be injected into an existing `BasicBlock` represented by this
128- // `BasicCoverageBlock`).
129- counter_kind. is_expression( ) || !self . bcb_has_incoming_edge_counters. contains( bcb) ,
130- "attempt to add a `Counter` to a BCB target with existing incoming edge counters"
131- ) ;
132-
133115 if let Some ( replaced) = self . bcb_counters [ bcb] . replace ( counter_kind) {
134116 bug ! (
135117 "attempt to set a BasicCoverageBlock coverage counter more than once; \
@@ -146,19 +128,6 @@ impl CoverageCounters {
146128 to_bcb : BasicCoverageBlock ,
147129 counter_kind : BcbCounter ,
148130 ) -> BcbCounter {
149- // If the BCB has an edge counter (to be injected into a new `BasicBlock`), it can also
150- // have an expression (to be injected into an existing `BasicBlock` represented by this
151- // `BasicCoverageBlock`).
152- if let Some ( node_counter) = self . bcb_counter ( to_bcb)
153- && !node_counter. is_expression ( )
154- {
155- bug ! (
156- "attempt to add an incoming edge counter from {from_bcb:?} \
157- when the target BCB already has {node_counter:?}"
158- ) ;
159- }
160-
161- self . bcb_has_incoming_edge_counters . insert ( to_bcb) ;
162131 if let Some ( replaced) = self . bcb_edge_counters . insert ( ( from_bcb, to_bcb) , counter_kind) {
163132 bug ! (
164133 "attempt to set an edge counter more than once; from_bcb: \
0 commit comments