Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(optimization): Follow past
array_set
s when optimizing `array_g…
…et`s (#5772) # Description ## Problem\* Resolves #5767 ## Summary\* Instead of checking if an array_get is from a constant array, we can follow array_sets to find a previous constant array. If the index was ever unknown we fail to optimize. If the index is known but changed by an array set we fail as well instead of optimizing to the set value. This is in case the side effect variables are different for the get & set. ## Additional Context I set an arbitrary maximum of 5 array_sets to check before giving up and failing to find a constant array. ## 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. --------- Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
- Loading branch information