mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 15:32:06 +00:00
Ignore terminators explicitly
This commit is contained in:
parent
469fb197d0
commit
16dedba1c8
@ -146,10 +146,7 @@ pub trait ValueAnalysis<'tcx> {
|
|||||||
Rvalue::CopyForDeref(place) => {
|
Rvalue::CopyForDeref(place) => {
|
||||||
self.handle_operand(&Operand::Copy(*place), state).into()
|
self.handle_operand(&Operand::Copy(*place), state).into()
|
||||||
}
|
}
|
||||||
_ => {
|
_ => ValueOrPlaceOrRef::Unknown,
|
||||||
// FIXME: Check that other Rvalues really have no side-effect.
|
|
||||||
ValueOrPlaceOrRef::Unknown
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +197,20 @@ pub trait ValueAnalysis<'tcx> {
|
|||||||
self.super_terminator(terminator, state)
|
self.super_terminator(terminator, state)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn super_terminator(&self, _terminator: &Terminator<'tcx>, _state: &mut State<Self::Value>) {}
|
fn super_terminator(&self, terminator: &Terminator<'tcx>, _state: &mut State<Self::Value>) {
|
||||||
|
match &terminator.kind {
|
||||||
|
TerminatorKind::Call { .. } | TerminatorKind::InlineAsm { .. } => {
|
||||||
|
// Effect is applied by `handle_call_return`.
|
||||||
|
}
|
||||||
|
TerminatorKind::DropAndReplace { .. } | TerminatorKind::Yield { .. } => {
|
||||||
|
// They would have an effect, but are not allowed in this phase.
|
||||||
|
bug!("encountered disallowed terminator");
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
// The other terminators can be ignored.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn handle_call_return(
|
fn handle_call_return(
|
||||||
&self,
|
&self,
|
||||||
|
@ -35,7 +35,6 @@ impl<'tcx> MirPass<'tcx> for DataflowConstProp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Consider support for discriminants, mutable references, arrays and slices.
|
|
||||||
struct ConstAnalysis<'tcx> {
|
struct ConstAnalysis<'tcx> {
|
||||||
map: Map,
|
map: Map,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
|
Loading…
Reference in New Issue
Block a user