Skip to content

Commit

Permalink
Move dominators from Body to BasicBlocks
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiasko committed Jul 7, 2022
1 parent dfa6a7c commit 17adfeb
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/invalidation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub(super) fn generate_invalidates<'tcx>(

if let Some(all_facts) = all_facts {
let _prof_timer = tcx.prof.generic_activity("polonius_fact_generation");
let dominators = body.dominators();
let dominators = body.basic_blocks.dominators();
let mut ig = InvalidationGenerator {
all_facts,
borrow_set,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ fn do_mir_borrowck<'a, 'tcx>(
};
}

let dominators = body.dominators();
let dominators = body.basic_blocks.dominators();

let mut mbcx = MirBorrowckCtxt {
infcx,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/mir/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
fx: &FunctionCx<'a, 'tcx, Bx>,
) -> BitSet<mir::Local> {
let mir = fx.mir;
let dominators = mir.dominators();
let dominators = mir.basic_blocks.dominators();
let locals = mir
.local_decls
.iter()
Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_middle/src/mir/basic_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::mir::traversal::PostorderCache;
use crate::mir::{BasicBlock, BasicBlockData, Successors, START_BLOCK};

use rustc_data_structures::graph;
use rustc_data_structures::graph::dominators::{dominators, Dominators};
use rustc_index::vec::IndexVec;

#[derive(Clone, TyEncodable, TyDecodable, Debug, HashStable, TypeFoldable, TypeVisitable)]
Expand Down Expand Up @@ -34,6 +35,11 @@ impl<'tcx> BasicBlocks<'tcx> {
self.is_cyclic.is_cyclic(self)
}

#[inline]
pub fn dominators(&self) -> Dominators<BasicBlock> {
dominators(&self)
}

/// Returns predecessors for each basic block.
#[inline]
pub fn predecessors(&self) -> &Predecessors {
Expand Down
7 changes: 1 addition & 6 deletions compiler/rustc_middle/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use rustc_target::abi::{Size, VariantIdx};
use polonius_engine::Atom;
pub use rustc_ast::Mutability;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::graph::dominators::{dominators, Dominators};
use rustc_data_structures::graph::dominators::Dominators;
use rustc_index::bit_set::BitMatrix;
use rustc_index::vec::{Idx, IndexVec};
use rustc_serialize::{Decodable, Encodable};
Expand Down Expand Up @@ -447,11 +447,6 @@ impl<'tcx> Body<'tcx> {
.unwrap_or_else(|| Either::Right(block_data.terminator()))
}

#[inline]
pub fn dominators(&self) -> Dominators<BasicBlock> {
dominators(&self.basic_blocks)
}

#[inline]
pub fn yield_ty(&self) -> Option<Ty<'tcx>> {
self.generator.as_ref().and_then(|generator| generator.yield_ty)
Expand Down

0 comments on commit 17adfeb

Please sign in to comment.