1
Fork 0

Auto merge of #131244 - clubby789:match-branches-unreachable, r=DianQK

Consider empty-unreachable otherwise branches in MatchBranchSimplification

Fixes #131219
This commit is contained in:
bors 2024-12-28 11:09:28 +00:00
commit 4e0bc490c6
7 changed files with 108 additions and 29 deletions

View file

@ -67,6 +67,17 @@ impl SwitchTargets {
&mut self.targets
}
/// Returns a slice with all considered values (not including the fallback).
#[inline]
pub fn all_values(&self) -> &[Pu128] {
&self.values
}
#[inline]
pub fn all_values_mut(&mut self) -> &mut [Pu128] {
&mut self.values
}
/// Finds the `BasicBlock` to which this `SwitchInt` will branch given the
/// specific value. This cannot fail, as it'll return the `otherwise`
/// branch if there's not a specific match for the value.