Skip to content

Commit

Permalink
Remove abbreviation
Browse files Browse the repository at this point in the history
  • Loading branch information
jfecher committed Nov 28, 2023
1 parent af6b221 commit c09a7e4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions compiler/noirc_evaluator/src/ssa/opt/die.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn dead_instruction_elimination(function: &mut Function) {
context.remove_unused_instructions_in_block(function, *block);
}

context.remove_inc_rc_instructions(&mut function.dfg);
context.remove_increment_rc_instructions(&mut function.dfg);
}

/// Per function context for tracking unused values and which instructions to remove.
Expand All @@ -51,7 +51,7 @@ struct Context {
/// IncrementRc instructions must be revisited after the main DIE pass since
/// they are technically side-effectful but we stil want to remove them if their

Check warning on line 52 in compiler/noirc_evaluator/src/ssa/opt/die.rs

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (effectful)

Check warning on line 52 in compiler/noirc_evaluator/src/ssa/opt/die.rs

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (stil)
/// `value` parameter is not used elsewhere.
inc_rc_instructions: Vec<(InstructionId, BasicBlockId)>,
increment_rc_instructions: Vec<(InstructionId, BasicBlockId)>,
}

impl Context {
Expand Down Expand Up @@ -81,7 +81,7 @@ impl Context {
let instruction = &function.dfg[*instruction_id];

if let Instruction::IncrementRc { .. } = instruction {
self.inc_rc_instructions.push((*instruction_id, block_id));
self.increment_rc_instructions.push((*instruction_id, block_id));
} else {
instruction.for_each_value(|value| {
self.mark_used_instruction_results(&function.dfg, value);
Expand Down Expand Up @@ -140,16 +140,16 @@ impl Context {
}
}

fn remove_inc_rc_instructions(self, dfg: &mut DataFlowGraph) {
for (inc_rc, block) in self.inc_rc_instructions {
let value = match &dfg[inc_rc] {
fn remove_increment_rc_instructions(self, dfg: &mut DataFlowGraph) {
for (increment_rc, block) in self.increment_rc_instructions {
let value = match &dfg[increment_rc] {
Instruction::IncrementRc { value } => *value,
other => unreachable!("Expected IncrementRc instruction, found {other:?}"),
};

// This could be more efficient if we have to remove multiple inc_rcs in a single block
// This could be more efficient if we have to remove multiple IncrementRcs in a single block
if !self.used_values.contains(&value) {
dfg[block].instructions_mut().retain(|instruction| *instruction != inc_rc);
dfg[block].instructions_mut().retain(|instruction| *instruction != increment_rc);
}
}
}
Expand Down

0 comments on commit c09a7e4

Please sign in to comment.