diff options
| author | bors <bors@rust-lang.org> | 2023-02-26 17:17:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-02-26 17:17:25 +0000 |
| commit | 56ac6bfc87cce22feffc079c0540c8774b00a5ca (patch) | |
| tree | e430c91fb4e29070945f79df7a47639e5cf4f9b1 /compiler/rustc_mir_dataflow/src | |
| parent | ffd12f67cfa28891bbd1fa81d5e80a128f346ace (diff) | |
| parent | cb45103358c0fef99d7659e0949b3c65b3eabdd6 (diff) | |
| download | rust-56ac6bfc87cce22feffc079c0540c8774b00a5ca.tar.gz rust-56ac6bfc87cce22feffc079c0540c8774b00a5ca.zip | |
Auto merge of #2803 - RalfJung:rustup, r=RalfJung
Rustup
Diffstat (limited to 'compiler/rustc_mir_dataflow/src')
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/framework/direction.rs | 31 | ||||
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/framework/engine.rs | 32 | ||||
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/lib.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/move_paths/builder.rs | 6 |
4 files changed, 12 insertions, 61 deletions
diff --git a/compiler/rustc_mir_dataflow/src/framework/direction.rs b/compiler/rustc_mir_dataflow/src/framework/direction.rs index 077a21fc8af..2ae3ae02fcc 100644 --- a/compiler/rustc_mir_dataflow/src/framework/direction.rs +++ b/compiler/rustc_mir_dataflow/src/framework/direction.rs @@ -1,4 +1,3 @@ -use rustc_index::bit_set::BitSet; use rustc_middle::mir::{self, BasicBlock, Location, SwitchTargets}; use rustc_middle::ty::TyCtxt; use std::ops::RangeInclusive; @@ -54,7 +53,6 @@ pub trait Direction { analysis: &A, tcx: TyCtxt<'tcx>, body: &mir::Body<'tcx>, - dead_unwinds: Option<&BitSet<BasicBlock>>, exit_state: &mut A::Domain, block: (BasicBlock, &'_ mir::BasicBlockData<'tcx>), propagate: impl FnMut(BasicBlock, &A::Domain), @@ -221,7 +219,6 @@ impl Direction for Backward { analysis: &A, _tcx: TyCtxt<'tcx>, body: &mir::Body<'tcx>, - dead_unwinds: Option<&BitSet<BasicBlock>>, exit_state: &mut A::Domain, (bb, _bb_data): (BasicBlock, &'_ mir::BasicBlockData<'tcx>), mut propagate: impl FnMut(BasicBlock, &A::Domain), @@ -278,20 +275,6 @@ impl Direction for Backward { } } - // Ignore dead unwinds. - mir::TerminatorKind::Call { cleanup: Some(unwind), .. } - | mir::TerminatorKind::Assert { cleanup: Some(unwind), .. } - | mir::TerminatorKind::Drop { unwind: Some(unwind), .. } - | mir::TerminatorKind::DropAndReplace { unwind: Some(unwind), .. } - | mir::TerminatorKind::FalseUnwind { unwind: Some(unwind), .. } - | mir::TerminatorKind::InlineAsm { cleanup: Some(unwind), .. } - if unwind == bb => - { - if dead_unwinds.map_or(true, |dead| !dead.contains(pred)) { - propagate(pred, exit_state); - } - } - _ => propagate(pred, exit_state), } } @@ -304,7 +287,6 @@ struct BackwardSwitchIntEdgeEffectsApplier<'a, 'tcx, D, F> { exit_state: &'a mut D, bb: BasicBlock, propagate: &'a mut F, - effects_applied: bool, } @@ -484,7 +466,6 @@ impl Direction for Forward { analysis: &A, _tcx: TyCtxt<'tcx>, _body: &mir::Body<'tcx>, - dead_unwinds: Option<&BitSet<BasicBlock>>, exit_state: &mut A::Domain, (bb, bb_data): (BasicBlock, &'_ mir::BasicBlockData<'tcx>), mut propagate: impl FnMut(BasicBlock, &A::Domain), @@ -502,9 +483,7 @@ impl Direction for Forward { | DropAndReplace { target, unwind, value: _, place: _ } | FalseUnwind { real_target: target, unwind } => { if let Some(unwind) = unwind { - if dead_unwinds.map_or(true, |dead| !dead.contains(bb)) { - propagate(unwind, exit_state); - } + propagate(unwind, exit_state); } propagate(target, exit_state); @@ -534,9 +513,7 @@ impl Direction for Forward { fn_span: _, } => { if let Some(unwind) = cleanup { - if dead_unwinds.map_or(true, |dead| !dead.contains(bb)) { - propagate(unwind, exit_state); - } + propagate(unwind, exit_state); } if let Some(target) = target { @@ -560,9 +537,7 @@ impl Direction for Forward { cleanup, } => { if let Some(unwind) = cleanup { - if dead_unwinds.map_or(true, |dead| !dead.contains(bb)) { - propagate(unwind, exit_state); - } + propagate(unwind, exit_state); } if let Some(target) = destination { diff --git a/compiler/rustc_mir_dataflow/src/framework/engine.rs b/compiler/rustc_mir_dataflow/src/framework/engine.rs index 6ddbe69e17e..91c3bf0ad21 100644 --- a/compiler/rustc_mir_dataflow/src/framework/engine.rs +++ b/compiler/rustc_mir_dataflow/src/framework/engine.rs @@ -12,7 +12,6 @@ use rustc_ast as ast; use rustc_data_structures::work_queue::WorkQueue; use rustc_graphviz as dot; use rustc_hir::def_id::DefId; -use rustc_index::bit_set::BitSet; use rustc_index::vec::{Idx, IndexVec}; use rustc_middle::mir::{self, traversal, BasicBlock}; use rustc_middle::mir::{create_dump_file, dump_enabled}; @@ -78,7 +77,6 @@ where { tcx: TyCtxt<'tcx>, body: &'a mir::Body<'tcx>, - dead_unwinds: Option<&'a BitSet<BasicBlock>>, entry_sets: IndexVec<BasicBlock, A::Domain>, pass_name: Option<&'static str>, analysis: A, @@ -154,25 +152,7 @@ where bug!("`initialize_start_block` is not yet supported for backward dataflow analyses"); } - Engine { - analysis, - tcx, - body, - dead_unwinds: None, - pass_name: None, - entry_sets, - apply_trans_for_block, - } - } - - /// Signals that we do not want dataflow state to propagate across unwind edges for these - /// `BasicBlock`s. - /// - /// You must take care that `dead_unwinds` does not contain a `BasicBlock` that *can* actually - /// unwind during execution. Otherwise, your dataflow results will not be correct. - pub fn dead_unwinds(mut self, dead_unwinds: &'a BitSet<BasicBlock>) -> Self { - self.dead_unwinds = Some(dead_unwinds); - self + Engine { analysis, tcx, body, pass_name: None, entry_sets, apply_trans_for_block } } /// Adds an identifier to the graphviz output for this particular run of a dataflow analysis. @@ -190,14 +170,7 @@ where A::Domain: DebugWithContext<A>, { let Engine { - analysis, - body, - dead_unwinds, - mut entry_sets, - tcx, - apply_trans_for_block, - pass_name, - .. + analysis, body, mut entry_sets, tcx, apply_trans_for_block, pass_name, .. } = self; let mut dirty_queue: WorkQueue<BasicBlock> = WorkQueue::with_none(body.basic_blocks.len()); @@ -236,7 +209,6 @@ where &analysis, tcx, body, - dead_unwinds, &mut state, (bb, bb_data), |target: BasicBlock, state: &A::Domain| { diff --git a/compiler/rustc_mir_dataflow/src/lib.rs b/compiler/rustc_mir_dataflow/src/lib.rs index 3e382f500af..b1e03faff05 100644 --- a/compiler/rustc_mir_dataflow/src/lib.rs +++ b/compiler/rustc_mir_dataflow/src/lib.rs @@ -16,7 +16,9 @@ extern crate tracing; extern crate rustc_middle; use rustc_ast::MetaItem; +use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage}; use rustc_hir::def_id::DefId; +use rustc_macros::fluent_messages; use rustc_middle::ty::{self, TyCtxt}; use rustc_span::symbol::{sym, Symbol}; @@ -44,6 +46,8 @@ pub mod storage; pub mod un_derefer; pub mod value_analysis; +fluent_messages! { "../locales/en-US.ftl" } + pub(crate) mod indexes { pub(crate) use super::move_paths::MovePathIndex; } diff --git a/compiler/rustc_mir_dataflow/src/move_paths/builder.rs b/compiler/rustc_mir_dataflow/src/move_paths/builder.rs index 6d30276aeab..4a163028fcf 100644 --- a/compiler/rustc_mir_dataflow/src/move_paths/builder.rs +++ b/compiler/rustc_mir_dataflow/src/move_paths/builder.rs @@ -126,7 +126,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> { BorrowedContent { target_place: Place { local: place.local, - projection: tcx.intern_place_elems(proj), + projection: tcx.mk_place_elems(proj), }, }, )); @@ -165,7 +165,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> { if union_path.is_none() { base = self.add_move_path(base, elem, |tcx| Place { local: place.local, - projection: tcx.intern_place_elems(&place.projection[..i + 1]), + projection: tcx.mk_place_elems(&place.projection[..i + 1]), }); } } @@ -476,7 +476,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> { // `ConstIndex` patterns. This is done to ensure that all move paths // are disjoint, which is expected by drop elaboration. let base_place = - Place { local: place.local, projection: self.builder.tcx.intern_place_elems(base) }; + Place { local: place.local, projection: self.builder.tcx.mk_place_elems(base) }; let base_path = match self.move_path_for(base_place) { Ok(path) => path, Err(MoveError::UnionMove { path }) => { |
