-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Performance improvements for new integers #8897
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
Merged
swiftix
merged 4 commits into
swiftlang:master
from
swiftix:new-integer-perf-improvements
Apr 21, 2017
Merged
Performance improvements for new integers #8897
swiftix
merged 4 commits into
swiftlang:master
from
swiftix:new-integer-perf-improvements
Apr 21, 2017
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Convert i1_const != X to X != i1_const. Convert i1_const == X to X == i1_const.
Add the following peepholes: cond_br(x == 0), t_label, f_label -> cond_br x, f_label, t_label cond_br (x != 1), t_label, f_label -> cond_br x, f_label, t_label
Make use of the following inequalities: 1) Int.max >= X, X <= Int.max are always true for any signed integer X 2) Int.max < X, X > Int.max are always false for any signed integer X 3) For any X of the same size as Int.max and any n>=1 , (X>>n) is always <= Int.max, that is (X>>n) <= Int.max and Int.max >= (X>>n) are always true. At the same time (X>>n) > Int.max and Int.max < (X>>n) is always false. 4) X < 0 is always false, if X is known to be a result of an unsigned operation with overflow checks enabled. X >= 0 is always true, if X is known to be a result of an unsigned operation with overflow checks enabled.
- Code-refactoring - Support for comparison followed by a cond_fail - Correctness fixes for relation propagation
@swift-ci please test |
@swiftix thank you, and thanks especially for a solution that doesn't need to touch the standard library! |
@swift-ci please benchmark |
Build comment file:Optimized (O) Regression (12)
Improvement (27)
No Changes (328)
Regression (3)
Improvement (15)
No Changes (349)
|
cool! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A set of of small peepholes to improve the performance of new integers: