Avoid constructing switch sources unless necessary
Switch sources are used by backward analysis with a custom switch int edge effects, but are otherwise unnecessarily computed. Delay the computation until we know that switch sources are indeed required and avoid the computation otherwise.
This commit is contained in:
parent
83322c557f
commit
fbc3cc18be
2 changed files with 6 additions and 3 deletions
|
@ -580,6 +580,8 @@ impl<'tcx> Body<'tcx> {
|
|||
self.predecessor_cache.compute(&self.basic_blocks)
|
||||
}
|
||||
|
||||
/// `body.switch_sources()[target][switch]` returns a list of switch values
|
||||
/// that lead to a `target` block from a `switch` block.
|
||||
#[inline]
|
||||
pub fn switch_sources(&self) -> &SwitchSources {
|
||||
self.switch_source_cache.compute(&self.basic_blocks)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue