Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Sep 24, 2024
1 parent 9b1e674 commit bce1347
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compiler/noirc_evaluator/src/ssa/opt/mem2reg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,8 @@ impl<'f> PerFunctionContext<'f> {

fn reduce_load_result_count(&mut self, value: ValueId) {
if let Some(context) = self.load_results.get_mut(&value) {
context.uses = context.uses.saturating_sub(1);
// TODO this was saturating https://github.com/noir-lang/noir/issues/6124
context.uses = context.uses.wrapping_sub(1);
}
}

Expand Down Expand Up @@ -743,7 +744,8 @@ impl<'f> PerFunctionContext<'f> {
if all_loads_removed && !store_alias_used {
self.instructions_to_remove.insert(*store_instruction);
if let Some((_, counter)) = remaining_last_stores.get_mut(store_address) {
*counter = counter.saturating_sub(1);
// TODO this was saturating https://github.com/noir-lang/noir/issues/6124
*counter = counter.wrapping_sub(1);
}
} else if let Some((_, counter)) = remaining_last_stores.get_mut(store_address) {
*counter += 1;
Expand Down

0 comments on commit bce1347

Please sign in to comment.