-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prevent
Instruction::Constrain
s for non-primitive types (#3916)
# Description ## Problem\* Followup to #3740 ## Summary\* #3740 fixed an issue where array equalities were making their way into SSA and not having side effect predicates applied correctly by applying the predicate to each of the array elements. We actually state that we do not want array equalities in SSA (in `insert_array_equality`) so the fundamental issue of array equalities in SSA still exists. We were allowing an implicit array equality to sneak into SSA by performing an optimization of `Constrain(Eq(x, y), 1)` into `Constrain(x, y)` during codegen. This meant that if `x` and `y` were arrays then we bypass the `insert_array_equality` function which the `Eq` instruction would call, which would have calculated a primitive predicate value for the constrain statement to act on. This PR removes the extra logic from the `flatten_cfg` pass (while adding an assert that we're only constraining primitive values) and removes the faulty optimization from SSA codegen. ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[Exceptional Case]** 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
1 parent
a63433f
commit 467948f
Showing
2 changed files
with
24 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters