-
Notifications
You must be signed in to change notification settings - Fork 10.5k
SILOptimizer: a new phi-argument expansion optimization. #31884
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
@swift-ci test |
@swift-ci benchmark |
Performance: -O
Code size: -O
Performance: -Osize
Code size: -Osize
Performance: -Onone
Code size: -swiftlibs
How 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
|
Here's the infinite loop case:
The other case is about ~500 instructions long so I won't post it here. Anyway, it's a simple fix. I'll submit a PR shortly. |
@eeckstein here's the PR that fixes it: #31894. Feel free to lump that into this PR so that it can have proper testing. |
@zoecarver Thanks, but I already fixed this some days ago: #31786 |
Oops. Somehow I missed that. This LGTM :) |
If only a single field of a struct phi-argument is used, replace the argument by the field value. br bb(%str) bb(%phi): %f = struct_extract %phi, #Field // the only use of %phi use %f is replaced with %f = struct_extract %str, #Field br bb(%f) bb(%phi): use %phi This also works if the phi-argument is in a def-use cycle. The new PhiExpansionPass is in the same file as the RedundantPhiEliminationPass. Therefore I renamed the source file to PhiArgumentOptimizations.cpp
@swift-ci smoke test and merge |
1 similar comment
@swift-ci smoke test and merge |
@swift-ci smoke test linux |
@swift-ci clean smoke test linux |
1 similar comment
@swift-ci clean smoke test linux |
@swift-ci test linux |
1 similar comment
@swift-ci test linux |
Build failed |
@swift-ci smoke test linux |
If only a single field of a struct phi-argument is used, replace the argument by the field value.
is replaced with
This also works if the phi-argument is in a def-use cycle.
The new PhiExpansionPass is in the same file as the RedundantPhiEliminationPass. Therefore I renamed the source file to PhiArgumentOptimizations.cpp
The motivation for this optimization is mainly to support the upcoming COW optimizations, where it's important that e.g. an array buffer reference is not wrapped in a struct.