1
Fork 0

Simplify visit_statement.

This commit is contained in:
Camille GILLOT 2023-03-07 14:41:13 +00:00
parent 9a56933e8c
commit 2247cd6643
2 changed files with 61 additions and 65 deletions

View file

@ -961,13 +961,14 @@ impl<'tcx> MutVisitor<'tcx> for ConstPropagator<'_, 'tcx> {
}
}
}
StatementKind::StorageLive(local) | StatementKind::StorageDead(local) => {
StatementKind::StorageLive(local) => {
let frame = self.ecx.frame_mut();
frame.locals[local].value = if let StatementKind::StorageLive(_) = statement.kind {
LocalValue::Live(interpret::Operand::Immediate(interpret::Immediate::Uninit))
} else {
LocalValue::Dead
};
frame.locals[local].value =
LocalValue::Live(interpret::Operand::Immediate(interpret::Immediate::Uninit));
}
StatementKind::StorageDead(local) => {
let frame = self.ecx.frame_mut();
frame.locals[local].value = LocalValue::Dead;
}
_ => {}
}