chore: simplify Expression in mem2reg#9599
Conversation
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Compilation Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 2158590 | Previous: ef436d0 | Ratio |
|---|---|---|---|
sha512-100-bytes |
1.991 s |
1.572 s |
1.27 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
jfecher
left a comment
There was a problem hiding this comment.
I'm not 100% sure I agree with this refactoring since like I mentioned in a prior comment it was the intention of the Expression enum to express nested expressions which should come up from nested dereferences/array accesses like ****foo or bar[0][0][0]. I think the fact that we don't ever use the recursiveness of the enum to be indicative of bugs we likely have handling aliases of these nested cases.
That being said, it is true that this better represents the code as we have it now and it's not too much more effort to re-add in the future (maybe during this same audit) if we get such a bug whose fix involves properly using this enum as intended. If that doesn't happen though, it'd be simpler for external auditors not to worry about this unhandled case.
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: some mem2reg refactors regarding expressions and aliases (noir-lang/noir#9610) feat: keep last loads from predecessors in mem2reg (noir-lang/noir#9492) chore: Update flattening docs (noir-lang/noir#9588) chore: remove redundant globals creation (noir-lang/noir#9606) chore: simplify Expression in mem2reg (noir-lang/noir#9599) chore: remove duplicate `contains_reference` in mem2reg (noir-lang/noir#9602) chore!: remove `verify_signature_slice` methods from stdlib (noir-lang/noir#9597) fix(expand): correctly handle nested dereferences (noir-lang/noir#9598) fix(ssa): Do not simplify on lhs being zero for shifts (noir-lang/noir#9596) chore: store last loads in `HashSet` instead of `HashMap` in mem2reg (noir-lang/noir#9498) chore: `--no-ssa-locations` for `nargo interpret` and show negative values when printing SSA (noir-lang/noir#9586) fix: `assert_constant` refactors and fixes from audit (noir-lang/noir#9547) fix(ssa): Consider `shl` and `shr` to have side effects (noir-lang/noir#9580) fix: avoid invalid cast in `remove_bit_shifts` (noir-lang/noir#9570) fix(mem2reg): Consider aliases of a loaded address to be loaded from as well (noir-lang/noir#9567) fix: Consume correct number of fields when printing references (noir-lang/noir#9579) chore: Add a section for numeric type aliases (noir-lang/noir#9589) chore(remove_paired_rc): Add various unit tests (noir-lang/noir#9425) fix: incorrect max bit size in `remove_bit_shifts` (noir-lang/noir#9585) chore(ssa): Simplify shl/shr identity operations (noir-lang/noir#9587) chore: greenlight `brillig_array_get_and_set` for audits (noir-lang/noir#9540) chore(ssa): Update comments on `loop_invariant` for audit and some missing unit tests (noir-lang/noir#9574) chore: Switch to node v22.15.0 (noir-lang/noir#9582) chore: Update unrolling docs for audit (noir-lang/noir#9572) chore: greenlight `array_set_optimization` (noir-lang/noir#9560) fix(acir_gen): Keep range checks before side effects (noir-lang/noir#9340) END_COMMIT_OVERRIDE
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: some mem2reg refactors regarding expressions and aliases (noir-lang/noir#9610) feat: keep last loads from predecessors in mem2reg (noir-lang/noir#9492) chore: Update flattening docs (noir-lang/noir#9588) chore: remove redundant globals creation (noir-lang/noir#9606) chore: simplify Expression in mem2reg (noir-lang/noir#9599) chore: remove duplicate `contains_reference` in mem2reg (noir-lang/noir#9602) chore!: remove `verify_signature_slice` methods from stdlib (noir-lang/noir#9597) fix(expand): correctly handle nested dereferences (noir-lang/noir#9598) fix(ssa): Do not simplify on lhs being zero for shifts (noir-lang/noir#9596) chore: store last loads in `HashSet` instead of `HashMap` in mem2reg (noir-lang/noir#9498) chore: `--no-ssa-locations` for `nargo interpret` and show negative values when printing SSA (noir-lang/noir#9586) fix: `assert_constant` refactors and fixes from audit (noir-lang/noir#9547) fix(ssa): Consider `shl` and `shr` to have side effects (noir-lang/noir#9580) fix: avoid invalid cast in `remove_bit_shifts` (noir-lang/noir#9570) fix(mem2reg): Consider aliases of a loaded address to be loaded from as well (noir-lang/noir#9567) fix: Consume correct number of fields when printing references (noir-lang/noir#9579) chore: Add a section for numeric type aliases (noir-lang/noir#9589) chore(remove_paired_rc): Add various unit tests (noir-lang/noir#9425) fix: incorrect max bit size in `remove_bit_shifts` (noir-lang/noir#9585) chore(ssa): Simplify shl/shr identity operations (noir-lang/noir#9587) chore: greenlight `brillig_array_get_and_set` for audits (noir-lang/noir#9540) chore(ssa): Update comments on `loop_invariant` for audit and some missing unit tests (noir-lang/noir#9574) chore: Switch to node v22.15.0 (noir-lang/noir#9582) chore: Update unrolling docs for audit (noir-lang/noir#9572) chore: greenlight `array_set_optimization` (noir-lang/noir#9560) fix(acir_gen): Keep range checks before side effects (noir-lang/noir#9340) END_COMMIT_OVERRIDE
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: some mem2reg refactors regarding expressions and aliases (noir-lang/noir#9610) feat: keep last loads from predecessors in mem2reg (noir-lang/noir#9492) chore: Update flattening docs (noir-lang/noir#9588) chore: remove redundant globals creation (noir-lang/noir#9606) chore: simplify Expression in mem2reg (noir-lang/noir#9599) chore: remove duplicate `contains_reference` in mem2reg (noir-lang/noir#9602) chore!: remove `verify_signature_slice` methods from stdlib (noir-lang/noir#9597) fix(expand): correctly handle nested dereferences (noir-lang/noir#9598) fix(ssa): Do not simplify on lhs being zero for shifts (noir-lang/noir#9596) chore: store last loads in `HashSet` instead of `HashMap` in mem2reg (noir-lang/noir#9498) chore: `--no-ssa-locations` for `nargo interpret` and show negative values when printing SSA (noir-lang/noir#9586) fix: `assert_constant` refactors and fixes from audit (noir-lang/noir#9547) fix(ssa): Consider `shl` and `shr` to have side effects (noir-lang/noir#9580) fix: avoid invalid cast in `remove_bit_shifts` (noir-lang/noir#9570) fix(mem2reg): Consider aliases of a loaded address to be loaded from as well (noir-lang/noir#9567) fix: Consume correct number of fields when printing references (noir-lang/noir#9579) chore: Add a section for numeric type aliases (noir-lang/noir#9589) chore(remove_paired_rc): Add various unit tests (noir-lang/noir#9425) fix: incorrect max bit size in `remove_bit_shifts` (noir-lang/noir#9585) chore(ssa): Simplify shl/shr identity operations (noir-lang/noir#9587) chore: greenlight `brillig_array_get_and_set` for audits (noir-lang/noir#9540) chore(ssa): Update comments on `loop_invariant` for audit and some missing unit tests (noir-lang/noir#9574) chore: Switch to node v22.15.0 (noir-lang/noir#9582) chore: Update unrolling docs for audit (noir-lang/noir#9572) chore: greenlight `array_set_optimization` (noir-lang/noir#9560) fix(acir_gen): Keep range checks before side effects (noir-lang/noir#9340) END_COMMIT_OVERRIDE
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: some mem2reg refactors regarding expressions and aliases (noir-lang/noir#9610) feat: keep last loads from predecessors in mem2reg (noir-lang/noir#9492) chore: Update flattening docs (noir-lang/noir#9588) chore: remove redundant globals creation (noir-lang/noir#9606) chore: simplify Expression in mem2reg (noir-lang/noir#9599) chore: remove duplicate `contains_reference` in mem2reg (noir-lang/noir#9602) chore!: remove `verify_signature_slice` methods from stdlib (noir-lang/noir#9597) fix(expand): correctly handle nested dereferences (noir-lang/noir#9598) fix(ssa): Do not simplify on lhs being zero for shifts (noir-lang/noir#9596) chore: store last loads in `HashSet` instead of `HashMap` in mem2reg (noir-lang/noir#9498) chore: `--no-ssa-locations` for `nargo interpret` and show negative values when printing SSA (noir-lang/noir#9586) fix: `assert_constant` refactors and fixes from audit (noir-lang/noir#9547) fix(ssa): Consider `shl` and `shr` to have side effects (noir-lang/noir#9580) fix: avoid invalid cast in `remove_bit_shifts` (noir-lang/noir#9570) fix(mem2reg): Consider aliases of a loaded address to be loaded from as well (noir-lang/noir#9567) fix: Consume correct number of fields when printing references (noir-lang/noir#9579) chore: Add a section for numeric type aliases (noir-lang/noir#9589) chore(remove_paired_rc): Add various unit tests (noir-lang/noir#9425) fix: incorrect max bit size in `remove_bit_shifts` (noir-lang/noir#9585) chore(ssa): Simplify shl/shr identity operations (noir-lang/noir#9587) chore: greenlight `brillig_array_get_and_set` for audits (noir-lang/noir#9540) chore(ssa): Update comments on `loop_invariant` for audit and some missing unit tests (noir-lang/noir#9574) chore: Switch to node v22.15.0 (noir-lang/noir#9582) chore: Update unrolling docs for audit (noir-lang/noir#9572) chore: greenlight `array_set_optimization` (noir-lang/noir#9560) fix(acir_gen): Keep range checks before side effects (noir-lang/noir#9340) END_COMMIT_OVERRIDE
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: some mem2reg refactors regarding expressions and aliases (noir-lang/noir#9610) feat: keep last loads from predecessors in mem2reg (noir-lang/noir#9492) chore: Update flattening docs (noir-lang/noir#9588) chore: remove redundant globals creation (noir-lang/noir#9606) chore: simplify Expression in mem2reg (noir-lang/noir#9599) chore: remove duplicate `contains_reference` in mem2reg (noir-lang/noir#9602) chore!: remove `verify_signature_slice` methods from stdlib (noir-lang/noir#9597) fix(expand): correctly handle nested dereferences (noir-lang/noir#9598) fix(ssa): Do not simplify on lhs being zero for shifts (noir-lang/noir#9596) chore: store last loads in `HashSet` instead of `HashMap` in mem2reg (noir-lang/noir#9498) chore: `--no-ssa-locations` for `nargo interpret` and show negative values when printing SSA (noir-lang/noir#9586) fix: `assert_constant` refactors and fixes from audit (noir-lang/noir#9547) fix(ssa): Consider `shl` and `shr` to have side effects (noir-lang/noir#9580) fix: avoid invalid cast in `remove_bit_shifts` (noir-lang/noir#9570) fix(mem2reg): Consider aliases of a loaded address to be loaded from as well (noir-lang/noir#9567) fix: Consume correct number of fields when printing references (noir-lang/noir#9579) chore: Add a section for numeric type aliases (noir-lang/noir#9589) chore(remove_paired_rc): Add various unit tests (noir-lang/noir#9425) fix: incorrect max bit size in `remove_bit_shifts` (noir-lang/noir#9585) chore(ssa): Simplify shl/shr identity operations (noir-lang/noir#9587) chore: greenlight `brillig_array_get_and_set` for audits (noir-lang/noir#9540) chore(ssa): Update comments on `loop_invariant` for audit and some missing unit tests (noir-lang/noir#9574) chore: Switch to node v22.15.0 (noir-lang/noir#9582) chore: Update unrolling docs for audit (noir-lang/noir#9572) chore: greenlight `array_set_optimization` (noir-lang/noir#9560) fix(acir_gen): Keep range checks before side effects (noir-lang/noir#9340) END_COMMIT_OVERRIDE
Description
Problem
Resolves one refactor in #9393
Summary
Additional Context
Documentation
Check one:
PR Checklist
cargo fmton default settings.