Skip to content

nightly-2024-04-12: fix: ArrayGet and Set are not pure (#4783)

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 12 Apr 02:13
· 1419 commits to master since this release
90ee479
# Description

## Problem\*

Resolves #4600

## Summary\*

Array sets and gets are not pure. Listing them as such can cause
constant folding to fold away enabled array gets for ones in disabled
contexts (enable_side_effects_if u1 0). When used in disabled contexts
they will only ever retrieve from index zero.

## Additional Context

No reproduceable test case unfortunately. The ones in #4600 all require
aztec as a dependency and the ones in #4717 only trigger with the
remove_if_else pass added there.

I'm going to add a SSA unit test instead where two array get
instructions should survive constant folding. This PR is a draft until I
add that.

## 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.