1
Fork 0

Add option to mir::MutVisitor to not invalidate CFG.

This also applies that option to some uses of the visitor
This commit is contained in:
Jakob Degen 2022-08-02 20:06:16 -07:00
parent 9ee22ff7e8
commit 7547084ff6
8 changed files with 101 additions and 72 deletions

View file

@ -951,7 +951,7 @@ impl<'tcx> MutVisitor<'tcx> for ConstPropagator<'_, 'tcx> {
}
fn visit_body(&mut self, body: &mut Body<'tcx>) {
for (bb, data) in body.basic_blocks_mut().iter_enumerated_mut() {
for (bb, data) in body.basic_blocks.as_mut_preserves_cfg().iter_enumerated_mut() {
self.visit_basic_block_data(bb, data);
}
}