-
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.
feat: remove truncations which can be seen to be noops using type inf…
…ormation (#3953) … # Description ## Problem\* Resolves <!-- Link to GitHub Issue --> ## Summary\* `Truncate`s which occur on outputs of `Binary(BinaryOp::Div)` can sometimes be determined to be noops based on type information. Put simply, if we have `(numerator / constant_denom) as T` then if `type_of(numerator)::max / constant_denom` fits inside `T` then we don't need to truncate the value. ## Additional Context Testing this on noir-rsa takes us from ``` +---------+----------------------+--------------+----------------------+ | Package | Expression Width | ACIR Opcodes | Backend Circuit Size | +---------+----------------------+--------------+----------------------+ | dkim | Bounded { width: 3 } | 1649234 | 3049613 | +---------+----------------------+--------------+----------------------+ ``` to ``` +---------+----------------------+--------------+----------------------+ | Package | Expression Width | ACIR Opcodes | Backend Circuit Size | +---------+----------------------+--------------+----------------------+ | dkim | Bounded { width: 3 } | 1486175 | 2764246 | +---------+----------------------+--------------+----------------------+ ``` ## 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
3b0f7d4
commit cc3c2c2
Showing
2 changed files
with
149 additions
and
11 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