Skip to content

Commit 3b77094

Browse files
committed
Remove limit
1 parent ee29825 commit 3b77094

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

compiler/rustc_mir_transform/src/deduplicate_blocks.rs

+2-11
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,8 @@ impl<'tcx> MirPass<'tcx> for DeduplicateBlocks {
2020
}
2121

2222
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-
2823
debug!("Running DeduplicateBlocks on `{:?}`", body.source);
29-
let duplicates = find_duplicates(body, limit);
24+
let duplicates = find_duplicates(body);
3025
let has_opts_to_apply = !duplicates.is_empty();
3126

3227
if has_opts_to_apply {
@@ -59,7 +54,7 @@ impl<'tcx> MutVisitor<'tcx> for OptApplier<'tcx> {
5954
}
6055
}
6156

62-
fn find_duplicates(body: &Body<'_>, limit: usize) -> FxHashMap<BasicBlock, BasicBlock> {
57+
fn find_duplicates(body: &Body<'_>) -> FxHashMap<BasicBlock, BasicBlock> {
6358
let mut duplicates = FxHashMap::default();
6459

6560
let bbs_to_go_through =
@@ -77,10 +72,6 @@ fn find_duplicates(body: &Body<'_>, limit: usize) -> FxHashMap<BasicBlock, Basic
7772
// with replacement bb3.
7873
// When the duplicates are removed, we will end up with only bb3.
7974
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-
8475
let to_hash = BasicBlockHashable { basic_block_data: bbd };
8576
let entry = same_hashes.entry(to_hash);
8677
match entry {

0 commit comments

Comments
 (0)