Remove SwitchIntTarget.
It's only passed to `Analysis::apply_switch_int_edge_effect`, and the existing impls of that method only use the `value` field. So pass that instead.
This commit is contained in:
@@ -5,7 +5,7 @@ use rustc_middle::mir::{
|
||||
};
|
||||
|
||||
use super::visitor::ResultsVisitor;
|
||||
use super::{Analysis, Effect, EffectIndex, Results, SwitchIntTarget};
|
||||
use super::{Analysis, Effect, EffectIndex, Results};
|
||||
|
||||
pub trait Direction {
|
||||
const IS_FORWARD: bool;
|
||||
@@ -117,8 +117,7 @@ impl Direction for Backward {
|
||||
let mut tmp = analysis.bottom_value(body);
|
||||
for &value in &body.basic_blocks.switch_sources()[&(block, pred)] {
|
||||
tmp.clone_from(exit_state);
|
||||
let si_target = SwitchIntTarget { value, target: block };
|
||||
analysis.apply_switch_int_edge_effect(&mut data, &mut tmp, si_target);
|
||||
analysis.apply_switch_int_edge_effect(&mut data, &mut tmp, value);
|
||||
propagate(pred, &tmp);
|
||||
}
|
||||
} else {
|
||||
@@ -292,9 +291,8 @@ impl Direction for Forward {
|
||||
let mut tmp = analysis.bottom_value(body);
|
||||
for (value, target) in targets.iter() {
|
||||
tmp.clone_from(exit_state);
|
||||
let si_target =
|
||||
SwitchIntTarget { value: SwitchTargetValue::Normal(value), target };
|
||||
analysis.apply_switch_int_edge_effect(&mut data, &mut tmp, si_target);
|
||||
let value = SwitchTargetValue::Normal(value);
|
||||
analysis.apply_switch_int_edge_effect(&mut data, &mut tmp, value);
|
||||
propagate(target, &tmp);
|
||||
}
|
||||
|
||||
@@ -305,7 +303,7 @@ impl Direction for Forward {
|
||||
analysis.apply_switch_int_edge_effect(
|
||||
&mut data,
|
||||
exit_state,
|
||||
SwitchIntTarget { value: SwitchTargetValue::Otherwise, target: otherwise },
|
||||
SwitchTargetValue::Otherwise,
|
||||
);
|
||||
propagate(otherwise, exit_state);
|
||||
} else {
|
||||
|
||||
@@ -222,7 +222,7 @@ pub trait Analysis<'tcx> {
|
||||
&mut self,
|
||||
_data: &mut Self::SwitchIntData,
|
||||
_state: &mut Self::Domain,
|
||||
_edge: SwitchIntTarget,
|
||||
_value: SwitchTargetValue,
|
||||
) {
|
||||
unreachable!();
|
||||
}
|
||||
@@ -432,10 +432,5 @@ impl EffectIndex {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SwitchIntTarget {
|
||||
pub value: SwitchTargetValue,
|
||||
pub target: BasicBlock,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
Reference in New Issue
Block a user