1
Fork 0

Use sparse representation of switch sources

to avoid quadratic space overhead
This commit is contained in:
Tomasz Miąsko 2022-05-08 00:00:00 +00:00
parent fbc3cc18be
commit 2be012a0c6
3 changed files with 8 additions and 10 deletions

View file

@ -580,8 +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.
/// `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)