Skip to content

Commit

Permalink
Reuse a Vec in mir simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
Marwes authored and Markus Westerlind committed Feb 13, 2020
1 parent 1f8df25 commit 851a701
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/librustc_mir/transform/simplify.rs
Expand Up @@ -94,6 +94,7 @@ impl<'a, 'tcx> CfgSimplifier<'a, 'tcx> {
self.strip_nops();

let mut start = START_BLOCK;
let mut new_stmts = vec![];

loop {
let mut changed = false;
Expand All @@ -114,7 +115,6 @@ impl<'a, 'tcx> CfgSimplifier<'a, 'tcx> {
self.collapse_goto_chain(successor, &mut changed);
}

let mut new_stmts = vec![];
let mut inner_changed = true;
while inner_changed {
inner_changed = false;
Expand All @@ -124,7 +124,7 @@ impl<'a, 'tcx> CfgSimplifier<'a, 'tcx> {
}

let data = &mut self.basic_blocks[bb];
data.statements.extend(new_stmts);
data.statements.extend(new_stmts.drain(..));
data.terminator = Some(terminator);

changed |= inner_changed;
Expand Down

0 comments on commit 851a701

Please sign in to comment.