Skip to content

Commit

Permalink
fix: revert PR #5449 (#5548)
Browse files Browse the repository at this point in the history
# Description

## Problem\*

PR #5449 introduces a new issue in aztec protocol circuits

## Summary\*
Revert the PR


## Additional Context
The test 'sort_get_split_order_hints_desc_non_zero_split_counter_empty'
is failing with the PR.
It is not clear to me why the PR is making this to fail.
One corner case that we could have when you replace a load with the
stored value is:
- loose the index bound check (i.e `A[i]=y; x=A[i] +5; `becomes `x=y+5`,
whether or not i is out-of-bounds.
- loose the side-effect; if the store is under a side-effect, replacing
it uses by the stored value is not conditional to the enable-side-effect
value anymore.


## Documentation\*

Check one:
- [X] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [X] I have tested the changes locally.
- [X] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
  • Loading branch information
guipublic authored Jul 18, 2024
1 parent 6b11445 commit a213c15
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions compiler/noirc_evaluator/src/ssa/ir/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,18 +602,6 @@ impl Instruction {
}
}
Instruction::ArrayGet { array, index } => {
if let Value::Instruction { instruction, .. } = &dfg[*array] {
if let Instruction::ArraySet { index: write_index, value, .. } =
dfg[*instruction]
{
// If we're reading from an index of the array which we just wrote to, we can return
// the value which we wrote without performing the read.
if dfg.resolve(write_index) == dfg.resolve(*index) {
return SimplifiedTo(value);
}
}
}

let array = dfg.get_array_constant(*array);
let index = dfg.get_numeric_constant(*index);
if let (Some((array, _)), Some(index)) = (array, index) {
Expand Down

0 comments on commit a213c15

Please sign in to comment.