Skip to content

Commit

Permalink
Add the new label, not the old one for simplicity
Browse files Browse the repository at this point in the history
  • Loading branch information
Pat-Lafon committed Jul 26, 2024
1 parent 6cf4d48 commit 3368738
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions brilirs/src/basic_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,10 @@ impl BBFunction {
match instr {
bril_rs::Code::Label { label, pos: _ } => {
if !curr_block.instrs.is_empty() || curr_block.label.is_some() {
if let Some(old_label) = curr_block.label.as_ref() {
label_map.insert(old_label.to_string(), blocks.len());
}
blocks.push(curr_block);
curr_block = BasicBlock::new();
}
label_map.insert(label.to_string(), blocks.len());
curr_block.label = Some(label);
}
bril_rs::Code::Instruction(i @ bril_rs::Instruction::Effect { op, .. })
Expand All @@ -232,9 +230,6 @@ impl BBFunction {
func_map,
)?);
curr_block.instrs.push(i);
if let Some(l) = curr_block.label.as_ref() {
label_map.insert(l.to_string(), blocks.len());
}
blocks.push(curr_block);
curr_block = BasicBlock::new();
}
Expand All @@ -251,9 +246,6 @@ impl BBFunction {
}

if !curr_block.instrs.is_empty() || curr_block.label.is_some() {
if let Some(l) = curr_block.label.as_ref() {
label_map.insert(l.to_string(), blocks.len());
}
blocks.push(curr_block);
}

Expand Down

0 comments on commit 3368738

Please sign in to comment.