Refactor apply_effects_in_block
.
Very minor changes that will make the next few commits easier to follow.
This commit is contained in:
parent
5bc6231454
commit
13003100f8
1 changed files with 7 additions and 13 deletions
|
@ -112,14 +112,11 @@ impl Direction for Backward {
|
||||||
|
|
||||||
mir::TerminatorKind::SwitchInt { targets: _, ref discr } => {
|
mir::TerminatorKind::SwitchInt { targets: _, ref discr } => {
|
||||||
if let Some(mut data) = analysis.get_switch_int_data(block, discr) {
|
if let Some(mut data) = analysis.get_switch_int_data(block, discr) {
|
||||||
let values = &body.basic_blocks.switch_sources()[&(block, pred)];
|
|
||||||
let targets =
|
|
||||||
values.iter().map(|&value| SwitchIntTarget { value, target: block });
|
|
||||||
|
|
||||||
let mut tmp = analysis.bottom_value(body);
|
let mut tmp = analysis.bottom_value(body);
|
||||||
for target in targets {
|
for &value in &body.basic_blocks.switch_sources()[&(block, pred)] {
|
||||||
tmp.clone_from(&exit_state);
|
tmp.clone_from(exit_state);
|
||||||
analysis.apply_switch_int_edge_effect(&mut data, &mut tmp, target);
|
let si_target = SwitchIntTarget { value, target: block };
|
||||||
|
analysis.apply_switch_int_edge_effect(&mut data, &mut tmp, si_target);
|
||||||
propagate(pred, &tmp);
|
propagate(pred, &tmp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -292,12 +289,9 @@ impl Direction for Forward {
|
||||||
if let Some(mut data) = analysis.get_switch_int_data(block, discr) {
|
if let Some(mut data) = analysis.get_switch_int_data(block, discr) {
|
||||||
let mut tmp = analysis.bottom_value(body);
|
let mut tmp = analysis.bottom_value(body);
|
||||||
for (value, target) in targets.iter() {
|
for (value, target) in targets.iter() {
|
||||||
tmp.clone_from(&exit_state);
|
tmp.clone_from(exit_state);
|
||||||
analysis.apply_switch_int_edge_effect(
|
let si_target = SwitchIntTarget { value: Some(value), target };
|
||||||
&mut data,
|
analysis.apply_switch_int_edge_effect(&mut data, &mut tmp, si_target);
|
||||||
&mut tmp,
|
|
||||||
SwitchIntTarget { value: Some(value), target },
|
|
||||||
);
|
|
||||||
propagate(target, &tmp);
|
propagate(target, &tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue