-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[opt] load promotion in mandatory combine #30463
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
[opt] load promotion in mandatory combine #30463
Conversation
@@ -547,6 +547,8 @@ bool tryOptimizeApplyOfPartialApply( | |||
PartialApplyInst *pai, SILBuilderContext &builderCtxt, | |||
InstModCallbacks callbacks = InstModCallbacks()); | |||
|
|||
bool dominatesAllUses(SILInstruction *a, SILValue b); |
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.
Implemented in #30464.
@swift-ci please benchmark. |
Performance: -O
Code size: -OPerformance: -OsizeCode size: -OsizePerformance: -OnoneCode size: -swiftlibsHow to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
I don't think it makes sense to do this at -Onone. It would make more sense to do a small bit of analysis to recognize the specific case. We need to be really careful at -Onone with compile time. @atrick your thoughts? |
That's a good point. Two alternatives: a) only scan single blocks (which would greatly reduce the complexity here) and b) only do this for |
@swift-ci please smoke test compiler performance. |
@swift-ci please smoke test compiler performance. |
@swift-ci please smoke test compiler performance |
Some todos:
|
This patch adds support for load promotion in mandatory combine. This is from #28536 and will be needed (or similar) to support all the optimizations done by closure cleanup in mandatory inlining.
For example:
Turns into (minus copies):
I plan to also add copy/destroy and store elimination in future patches which should help reduce the dead noise left behind.
This is one of the biggest single patches from #28536 the rest will be smaller (in size and scope). A lot of the logic here could also apply to mem2reg and #30308.