1
Fork 0

Remove dead code after destination propagation

This commit is contained in:
Tomasz Miąsko 2022-12-16 00:00:00 +00:00
parent ec56537c43
commit adf53d4b06
3 changed files with 111 additions and 0 deletions

View file

@ -129,6 +129,7 @@
use std::collections::hash_map::{Entry, OccupiedEntry};
use crate::simplify::remove_dead_blocks;
use crate::MirPass;
use rustc_data_structures::fx::FxHashMap;
use rustc_index::bit_set::BitSet;
@ -235,6 +236,12 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation {
apply_merges(body, tcx, &merges, &merged_locals);
}
if round_count != 0 {
// Merging can introduce overlap between moved arguments and/or call destination in an
// unreachable code, which validator considers to be ill-formed.
remove_dead_blocks(tcx, body);
}
trace!(round_count);
}
}