refactor BlockLoweringOrder::new (#6255)
Co-authored-by: Falk Zwimpfer <24669719+FalkZ@users.noreply.github.com> Co-authored-by: Moritz Waser <mzrw.dev@pm.me>
This commit is contained in:
committed by
GitHub
parent
8376944b3f
commit
1192697c7e
@@ -188,14 +188,10 @@ impl BlockLoweringOrder {
|
||||
// Step 2: walk the postorder from the domtree in reverse to produce our desired node
|
||||
// lowering order, identifying critical edges to split along the way.
|
||||
|
||||
let mut lb_to_bindex = FxHashMap::default();
|
||||
let mut lowered_order = Vec::new();
|
||||
|
||||
for &block in domtree.cfg_postorder().iter().rev() {
|
||||
let lb = LoweredBlock::Orig { block };
|
||||
let bindex = BlockIndex::new(lowered_order.len());
|
||||
lb_to_bindex.insert(lb.clone(), bindex);
|
||||
lowered_order.push(lb);
|
||||
lowered_order.push(LoweredBlock::Orig { block });
|
||||
|
||||
if block_out_count[block] > 1 {
|
||||
let range = block_succ_range[block].clone();
|
||||
@@ -209,14 +205,19 @@ impl BlockLoweringOrder {
|
||||
succ,
|
||||
succ_idx: succ_ix as u32,
|
||||
};
|
||||
let bindex = BlockIndex::new(lowered_order.len());
|
||||
lb_to_bindex.insert(*lb, bindex);
|
||||
lowered_order.push(*lb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let lb_to_bindex = FxHashMap::from_iter(
|
||||
lowered_order
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, &lb)| (lb, BlockIndex::new(i))),
|
||||
);
|
||||
|
||||
// Step 3: build the successor tables given the lowering order. We can't perform this step
|
||||
// during the creation of `lowering_order`, as we need `lb_to_bindex` to be fully populated
|
||||
// first.
|
||||
|
||||
Reference in New Issue
Block a user