-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ssa): Track RC instructions when removing last loads #6682
Conversation
Changes to Brillig bytecode sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
Peak Memory Sample
|
Changes to number of Brillig opcodes executed
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
This is strange to me as well. Of course copying versus mutating can be a breaking change but in the linked issue the two inc_rc instructions should be to the same array in either case. Agreed on needing to investigate further with getting a reproduceable example as well. I was testing something locally with the
Was returning |
This PR looks to now be causing I'm continuing to investigate. |
Sorry, I forgot the context of what I was looking at. The issue there was that DIE was removing RCs it shouldn't be, specifically the very first one. It's probably not related to this issue after all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sanity check: do we still need this at all after #6585 ?
If so, I'm happy merging this now and creating an issue for later to investigate why the extra load is needed.
It isn't needed after #6585. We probably can close it, as this PR is a bit of a hack and shouldn't be necessary if we are laying down the correct instructions. It looks to provide an ~10% improvement in the |
Ahh, another really odd result. Wish I knew why that was the case too. Anyway, I'll leave this to you on whether we should merge this or not |
I'm going to close this most likely but merging master to see its affect after all the RC changes. |
Now we get no improvements from doing this, which is as expected |
Description
Problem*
Resolves #6674
Summary*
This brings back code that was removed in #6019, but now for repeated loads rather than trivial stores. When analyzing instructions we check whether the last instruction was an inc_rc or a dec_rc. If it was, we do not remove the repeated load.
Needing to bring this back is very strange to me. Repeat loads are essentially "trivial loads" and an extra inc rc instruction as in #6674 (comment) should just cause our array to be copied rather than mutated. We should continue to try and get a small reproduction of the issue to understand it better and bring it into our test suite.
Another option is to simply revert #6088
Additional Context
Important information from the issue (#6674 (comment))
Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.