forked from FuelLabs/sway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
constcombine pass optimizing unary and binary operators (FuelLabs#4780)
## Description Closes FuelLabs#4708. This PR does NOT change the IR generation for expressions. Instead, it implements constant folding for unary and binary operators. The idea is that IR generation will be kept simple and stable, and all optimizations are pushed onto the opt passes. To better test this, this PR also changes some implementation details on IR generation tests: 1 - `filecheck` directives are now collected and tested in groups. This allows a new "::check-ir-optimized::", that can be configured with the passes you want to test, or just fallback to "o1". 2 - `filechecker` explanations are now pretty-printed, and can be printed when `verbose=true`. This allows the test to be checked more easily. ![image](https://github.com/FuelLabs/sway/assets/83425/75d0f628-b271-458d-8c33-7d4d47af789a) ![image](https://github.com/FuelLabs/sway/assets/83425/9591a3d5-b0b4-4623-8a7c-1a34f5f96a99) `breaking` label because of this change: https://github.com/FuelLabs/sway/pull/4780/files#diff-b40fc3999876b0ff447de112b508250c7d0e7993f9023db29ddce8590d9b2286L5 ## Checklist - [x] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [x] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [x] I have added tests that prove my fix is effective or that my feature works. - [x] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers. --------- Co-authored-by: Anton Trunov <[email protected]>
- Loading branch information
1 parent
c54b5d0
commit 7036a2c
Showing
7 changed files
with
646 additions
and
137 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
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
Oops, something went wrong.