Bugfix: block start point is at start of block, not end.

This commit is contained in:
Chris Fallin 2022-12-01 00:22:07 -08:00
parent 9730254c41
commit ae091d5319
No known key found for this signature in database
GPG key ID: 31649E4FE65EB465

View file

@ -60,6 +60,8 @@ impl<'a> Context<'a> {
let mut live: HashMap<Value, usize> = HashMap::default(); let mut live: HashMap<Value, usize> = HashMap::default();
let mut block_starts: HashMap<Block, usize> = HashMap::default(); let mut block_starts: HashMap<Block, usize> = HashMap::default();
for &block in &self.cfg.postorder { for &block in &self.cfg.postorder {
block_starts.insert(block, point);
self.body.blocks[block].terminator.visit_uses(|u| { self.body.blocks[block].terminator.visit_uses(|u| {
self.handle_use(&mut live, &mut point, u); self.handle_use(&mut live, &mut point, u);
}); });
@ -75,8 +77,6 @@ impl<'a> Context<'a> {
} }
point += 1; point += 1;
block_starts.insert(block, point);
// If there were any in-edges from blocks numbered earlier // If there were any in-edges from blocks numbered earlier
// in postorder ("loop backedges"), extend the start of // in postorder ("loop backedges"), extend the start of
// the backward-range on all live values at this point to // the backward-range on all live values at this point to