Propagate cold annotations to edge blocks (#4636)

Update the lowering stage to mark edge blocks as cold if either the
predecessor or successor block is cold.
This commit is contained in:
Michael Chesser
2022-08-09 14:35:57 +09:30
committed by GitHub
parent 0b1f51f804
commit 8aee85ebaa
2 changed files with 17 additions and 9 deletions

View File

@@ -432,12 +432,19 @@ impl BlockLoweringOrder {
lowered_order.push(block);
lowered_succ_ranges.push(succ_range);
if block
.orig_block()
.map(|b| f.layout.is_cold(b))
.unwrap_or(false)
{
cold_blocks.insert(index);
match block {
LoweredBlock::Orig { block }
| LoweredBlock::OrigAndEdge { block, .. }
| LoweredBlock::EdgeAndOrig { block, .. } => {
if f.layout.is_cold(block) {
cold_blocks.insert(index);
}
}
LoweredBlock::Edge { pred, succ, .. } => {
if f.layout.is_cold(pred) || f.layout.is_cold(succ) {
cold_blocks.insert(index);
}
}
}
}