Move predecessors from Body to BasicBlocks

This commit is contained in:
Tomasz Miąsko 2022-07-05 00:00:00 +00:00
parent 2446b17745
commit 39d9c1cb1f
9 changed files with 10 additions and 16 deletions

View file

@ -41,7 +41,6 @@ use std::fmt::{self, Debug, Display, Formatter, Write};
use std::ops::{ControlFlow, Index, IndexMut};
use std::{iter, mem};
use self::predecessors::Predecessors;
pub use self::query::*;
use self::switch_sources::SwitchSources;
pub use basic_blocks::BasicBlocks;
@ -449,11 +448,6 @@ impl<'tcx> Body<'tcx> {
.unwrap_or_else(|| Either::Right(block_data.terminator()))
}
#[inline]
pub fn predecessors(&self) -> &Predecessors {
self.basic_blocks.predecessors()
}
/// `body.switch_sources()[&(target, switch)]` returns a list of switch
/// values that lead to a `target` block from a `switch` block.
#[inline]
@ -2837,7 +2831,7 @@ impl Location {
return true;
}
let predecessors = body.predecessors();
let predecessors = body.basic_blocks.predecessors();
// If we're in another block, then we want to check that block is a predecessor of `other`.
let mut queue: Vec<BasicBlock> = predecessors[other.block].to_vec();