Auto merge of #119459 - cjgillot:inline-mir-utils, r=compiler-errors

Inline a few utility functions around MIR

Most of them are small enough to benefit from inlining.
This commit is contained in:
bors 2024-01-06 04:01:09 +00:00
commit d62f05b842
4 changed files with 24 additions and 0 deletions

View file

@ -1576,6 +1576,7 @@ impl Location {
///
/// Note that if this location represents a terminator, then the
/// resulting location would be out of bounds and invalid.
#[inline]
pub fn successor_within_block(&self) -> Location {
Location { block: self.block, statement_index: self.statement_index + 1 }
}
@ -1612,6 +1613,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
@ -1631,6 +1633,7 @@ pub enum DefLocation {
}
impl DefLocation {
#[inline]
pub fn dominates(self, location: Location, dominators: &Dominators<BasicBlock>) -> bool {
match self {
DefLocation::Argument => true,