@@ -113,7 +113,7 @@ use std::ops::Deref;
113
113
use std:: sync:: OnceLock ;
114
114
115
115
use itertools:: Itertools ;
116
- use rustc_data_structures:: fx:: FxHashMap ;
116
+ use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
117
117
use rustc_middle:: mir:: coverage:: * ;
118
118
use rustc_middle:: mir:: create_dump_file;
119
119
use rustc_middle:: mir:: generic_graphviz:: GraphvizWriter ;
@@ -488,7 +488,7 @@ pub(super) struct UsedExpressions {
488
488
489
489
#[ derive( Default ) ]
490
490
struct UsedExpressionsState {
491
- used_expression_operands : FxHashMap < Operand , Vec < ExpressionId > > ,
491
+ used_expression_operands : FxHashSet < Operand > ,
492
492
unused_expressions : Vec < ( BcbCounter , Option < BasicCoverageBlock > , BasicCoverageBlock ) > ,
493
493
}
494
494
@@ -509,16 +509,16 @@ impl UsedExpressions {
509
509
pub fn add_expression_operands ( & mut self , expression : & BcbCounter ) {
510
510
let Some ( state) = & mut self . state else { return } ;
511
511
512
- if let BcbCounter :: Expression { id , lhs, rhs, .. } = * expression {
513
- state. used_expression_operands . entry ( lhs) . or_insert_with ( Vec :: new ) . push ( id ) ;
514
- state. used_expression_operands . entry ( rhs) . or_insert_with ( Vec :: new ) . push ( id ) ;
512
+ if let BcbCounter :: Expression { lhs, rhs, .. } = * expression {
513
+ state. used_expression_operands . insert ( lhs) ;
514
+ state. used_expression_operands . insert ( rhs) ;
515
515
}
516
516
}
517
517
518
518
pub fn expression_is_used ( & self , expression : & BcbCounter ) -> bool {
519
519
let Some ( state) = & self . state else { return false } ;
520
520
521
- state. used_expression_operands . contains_key ( & expression. as_operand ( ) )
521
+ state. used_expression_operands . contains ( & expression. as_operand ( ) )
522
522
}
523
523
524
524
pub fn add_unused_expression_if_not_found (
@@ -529,7 +529,7 @@ impl UsedExpressions {
529
529
) {
530
530
let Some ( state) = & mut self . state else { return } ;
531
531
532
- if !state. used_expression_operands . contains_key ( & expression. as_operand ( ) ) {
532
+ if !state. used_expression_operands . contains ( & expression. as_operand ( ) ) {
533
533
state. unused_expressions . push ( ( expression. clone ( ) , edge_from_bcb, target_bcb) ) ;
534
534
}
535
535
}
0 commit comments