-
Notifications
You must be signed in to change notification settings - Fork 10.5k
SILOptimizer: two optimization improvements for address-only enums #34115
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
|
about the benchmark results: the Data benchmark regressions seem to be caused by data/code alignment changes. The generated code is the same. |
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.
Looks good to me, with a few comments below of things I would add.
When eliminating an enum from an alloc_stack, accept "dead" inject_enum_addr instructions, which inject different enum cases.
…ons. If the branch-block injects a certain enum case and the destination switches on that enum, it's worth jump threading. E.g. inject_enum_addr %enum : $*Optional<T>, #Optional.some ... // no memory writes here br DestBB DestBB: ... // no memory writes here switch_enum_addr %enum : $*Optional<T>, case #Optional.some ... This enables removing all code with optionals in a loop, which iterates over an array of address-only elements, e.g. func test<T>(_ items: [T]) { for i in items { print(i) } }
8d37f2c
to
0a71d0f
Compare
@atrick Thanks for reviewing. In this new version I addressed your comments. |
@swift-ci smoke test |
@swift-ci smoke test linux |
This PR contains 2 commits:
When eliminating an enum from an alloc_stack, accept "dead" inject_enum_addr instructions, which inject different enum cases.
If the branch-block injects a certain enum case and the destination switches on that enum, it's worth jump threading. E.g.
Both improvements enable removing all usages of optionals in loops, which iterate over arrays of address-only elements, e.g.
So this change is mainly an improvement for non-specialized generic code.