Inline dominator check.

This commit is contained in:
Camille GILLOT 2023-05-03 18:39:21 +00:00
parent c2354aabea
commit f83468c89b
3 changed files with 4 additions and 0 deletions

View File

@ -394,6 +394,7 @@ impl<Node: Idx> Dominators<Node> {
/// # Panics
///
/// Panics if `b` is unreachable.
#[inline]
pub fn dominates(&self, a: Node, b: Node) -> bool {
match &self.kind {
Kind::Path => a.index() <= b.index(),

View File

@ -1604,6 +1604,7 @@ impl Location {
false
}
#[inline]
pub fn dominates(&self, other: Location, dominators: &Dominators<BasicBlock>) -> bool {
if self.block == other.block {
self.statement_index <= other.statement_index
@ -1623,6 +1624,7 @@ pub enum DefLocation {
}
impl DefLocation {
#[inline]
pub fn dominates(self, location: Location, dominators: &Dominators<BasicBlock>) -> bool {
match self {
DefLocation::Argument => true,

View File

@ -94,6 +94,7 @@ impl SsaLocals {
self.direct_uses[local]
}
#[inline]
pub fn assignment_dominates(
&self,
dominators: &Dominators<BasicBlock>,