Reuse a Vec in mir simplification

This commit is contained in:
Markus Westerlind 2020-01-08 22:07:05 +01:00 committed by Markus Westerlind
parent 1f8df2508f
commit 851a701f90

View File

@ -94,6 +94,7 @@ pub fn simplify(mut self) {
self.strip_nops();
let mut start = START_BLOCK;
let mut new_stmts = vec![];
loop {
let mut changed = false;
@ -114,7 +115,6 @@ pub fn simplify(mut self) {
self.collapse_goto_chain(successor, &mut changed);
}
let mut new_stmts = vec![];
let mut inner_changed = true;
while inner_changed {
inner_changed = false;
@ -124,7 +124,7 @@ pub fn simplify(mut self) {
}
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;