@@ -20,13 +20,8 @@ impl<'tcx> MirPass<'tcx> for DeduplicateBlocks {
20
20
}
21
21
22
22
fn run_pass ( & self , tcx : TyCtxt < ' tcx > , body : & mut Body < ' tcx > ) {
23
- // Basic blocks can get really big, so to avoid checking for duplicates in basic blocks
24
- // that are unlikely to have duplicates, we stop early. The early bail number has been
25
- // found experimentally by eprintln while compiling the crates in the rustc-perf suite.
26
- let limit = if tcx. sess . mir_opt_level ( ) < 3 { 3 } else { 10 } ;
27
-
28
23
debug ! ( "Running DeduplicateBlocks on `{:?}`" , body. source) ;
29
- let duplicates = find_duplicates ( body, limit ) ;
24
+ let duplicates = find_duplicates ( body) ;
30
25
let has_opts_to_apply = !duplicates. is_empty ( ) ;
31
26
32
27
if has_opts_to_apply {
@@ -59,7 +54,7 @@ impl<'tcx> MutVisitor<'tcx> for OptApplier<'tcx> {
59
54
}
60
55
}
61
56
62
- fn find_duplicates ( body : & Body < ' _ > , limit : usize ) -> FxHashMap < BasicBlock , BasicBlock > {
57
+ fn find_duplicates ( body : & Body < ' _ > ) -> FxHashMap < BasicBlock , BasicBlock > {
63
58
let mut duplicates = FxHashMap :: default ( ) ;
64
59
65
60
let bbs_to_go_through =
@@ -77,10 +72,6 @@ fn find_duplicates(body: &Body<'_>, limit: usize) -> FxHashMap<BasicBlock, Basic
77
72
// with replacement bb3.
78
73
// When the duplicates are removed, we will end up with only bb3.
79
74
for ( bb, bbd) in body. basic_blocks . iter_enumerated ( ) . rev ( ) . filter ( |( _, bbd) | !bbd. is_cleanup ) {
80
- if bbd. statements . len ( ) > limit {
81
- continue ;
82
- }
83
-
84
75
let to_hash = BasicBlockHashable { basic_block_data : bbd } ;
85
76
let entry = same_hashes. entry ( to_hash) ;
86
77
match entry {
0 commit comments