Improve raw_ptr::write (1/n)#7646
Draft
xunilrj wants to merge 32 commits into
Draft
Conversation
Contributor
Author
|
e2e-gas-usage
e2e-bytecode-size
o2-bytecode-size
o2-gas-usage
|
Merging this PR will degrade performance by 20.32%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
Member
|
👍 |
ironcev
added a commit
that referenced
this pull request
Jun 11, 2026
## Description This PR is a necessary change for #7646. Some IR tests have a bug: their harness is expecting some passes to return `modified = true` even when the pass is not modifying anything. To make sure that #7646 is NOT changing the optimisation itself, but only fixing the `modified` flag, I am creating this PR. The idea is that #7646 snapshot tests will have only the flag changed, not their optimisation. ## Checklist - [ ] I have linked to any relevant issues. - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [ ] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [ ] 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). - [ ] I have requested a review from the relevant team or maintainers. --------- Co-authored-by: Igor Rončević <ironcev@hotmail.com>
5d5a052 to
7196d95
Compare
8 tasks
xunilrj
added a commit
that referenced
this pull request
Jun 17, 2026
## Description This PR is another prelude to #7646. We discovered that `memcpyopt` does not work when we run it multiple times. The cause is that we bail the optimisation when a symbol has more than one write. This is correct, but we were only considering 'store'. Now we are correctly also considering all other ways to write into "symbols". ## Checklist - [ ] I have linked to any relevant issues. - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [ ] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [ ] 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). - [ ] I have requested a review from the relevant team or maintainers.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR is the first of a series trying to make
raw_ptr::writeoptimal. For now, we tackle the issue that it was not being inlined.The issue is that we only check for inlining at certain points, and some optimisations were being run after this check, ignoring the inlining even when it made sense.
The solution is to run the optimisation pipeline multiple times, a standard practice. For that, I had to fix other passes that were returning
truefor modified even when they do not change anything. This allows us to break the loop as early as possible.Compilation time impact remains to be checked, but we can remove the loop on debug builds if that presents itself as a problem.
Checklist
Breaking*orNew Featurelabels where relevant.