-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Add a new memcpy propagation pass #7443
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
Conversation
CodSpeed Performance ReportMerging #7443 will not alter performanceComparing Summary
|
Impact on `should_pass` tests
On the blackjack Sway contract, the code size goes down from 21.144 KB to 21.048 KB |
ironcev
left a comment
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.
Considering the high importance of this pass, we should have dedicated ir_generation test(s) for it. And also add the pass to the pass_group in ir_generation. For tests, we can perhaps take the two examples from the original issue and ensure there are no additional memcpys.
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.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
I've added the test as a |
|
All review comments should be addressed now. @ironcev |
Description
For the Sway code in #7344, the IR after #7381 and after this PR is shown here:
After #7381, before this PR
After this PR
wrapper_1, which had 3memcpys now has 1, andreturn_option_5which had one, now has none.Closes #7344.
Note
Introduces a memcpy reverse copy-propagation pass, registers it, wires it into the Opt1 pipeline, and adds supporting IR utilities and tests.
MEMCPYPROP_REVERSE_NAMEwithcopy_prop_reverse()to propagatememcpysources to destinations (eliminate redundant copies) insway-ir/src/optimize/memcpyopt.rs.register_known_passes()and added toPassManager::OPTIMIZATION_PASSES.sway-core/src/lib.rsafterMEMCPYOPT_NAME(beforeSROA,MEM2REG,DCE).DomTree::dominates_instr()to check instruction dominance (sway-ir/src/analysis/dominator.rs).BlockArgument::as_value()(sway-ir/src/block.rs).Function::remove_instructions()to bulk-remove instructions (sway-ir/src/function.rs).memcpyopt: shareddeconstruct_memcpy(), enhancedis_clobbered()signature/logic, and safer use sites.sway-ir/src/pass_manager.rs).sway-ir/tests/memcpy_prop/memcpy_prop.irand harness wiring insway-ir/tests/tests.rs.Written by Cursor Bugbot for commit dd2528f. This will update automatically on new commits. Configure here.