Skip to content

Update some parts of SimplifyCFG for OSSA #61824

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
merged 11 commits into from
Jan 8, 2023

Conversation

meg-gupta
Copy link
Contributor

@meg-gupta meg-gupta commented Oct 31, 2022

This PR fixes and adds OSSA tests for the following SimplifyCFG transformations:

SimplifyCFG::simplifySwitchEnumBlock
SimplifyCFG::simplifySwitchEnumUnreachableBlocks
SimplifyCFG::simplifyTermWithIdenticalDestBlocks
SimplifyCFG::simplifyArgs
SimplifyCFG::simplifySwitchEnumOnObjcClassOptional

Left over transformations in SimplifyCFG not included in this PR are jump threading, dominator based simplifications and argument splitting, which will be posted in a subsequent PR.

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci test source compatibility

@meg-gupta
Copy link
Contributor Author

@swift-ci benchmark

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta meg-gupta marked this pull request as ready for review November 30, 2022 05:45
@meg-gupta
Copy link
Contributor Author

@swift-ci test source compatibility

@meg-gupta
Copy link
Contributor Author

@swift-ci benchmark

@meg-gupta
Copy link
Contributor Author

------- Performance (x86_64): -O -------

REGRESSION OLD NEW DELTA RATIO
Data.append.Sequence.64kB.Count 2.0 2.667 +33.3% 0.75x (?)
EqualStringSubstring 25.828 30.913 +19.7% 0.84x (?)
StringFromLongWholeSubstringGeneric 4.783 5.685 +18.9% 0.84x (?)
EqualSubstringSubstringGenericEquatable 26.063 30.6 +17.4% 0.85x (?)
LessSubstringSubstringGenericComparable 26.125 30.588 +17.1% 0.85x (?)
EqualSubstringString 26.412 30.8 +16.6% 0.86x (?)
LessSubstringSubstring 26.283 30.594 +16.4% 0.86x (?)
EqualSubstringSubstring 26.71 30.92 +15.8% 0.86x
DictionaryKeysContainsCocoa 14.537 16.452 +13.2% 0.88x (?)
StringComparison_longSharedPrefix 305.857 341.0 +11.5% 0.90x (?)
DistinctClassFieldAccesses 40.378 44.735 +10.8% 0.90x (?)
StringSwitch 224.5 243.143 +8.3% 0.92x (?)

IMPROVEMENT OLD NEW DELTA RATIO
ArrayAppendGenericStructs 1520.0 616.667 -59.4% 2.46x (?)
FlattenListLoop 1616.0 997.5 -38.3% 1.62x (?)
FlattenListFlatMap 3963.0 2875.0 -27.5% 1.38x (?)
String.replaceSubrange.Substring.Small 50.2 39.409 -21.5% 1.27x (?)
StringUTF16SubstringBuilder 1626.364 1413.0 -13.1% 1.15x (?)
StringComparison_ascii 368.0 328.5 -10.7% 1.12x (?)
OpenClose 54.435 50.08 -8.0% 1.09x (?)
String.replaceSubrange.ArrChar.Small 40.273 37.625 -6.6% 1.07x (?)

------- Performance (x86_64): -Osize -------

REGRESSION OLD NEW DELTA RATIO
EqualSubstringSubstring 25.304 30.586 +20.9% 0.83x (?)
StringFromLongWholeSubstringGeneric 4.717 5.64 +19.6% 0.84x (?)
EqualStringSubstring 25.852 30.577 +18.3% 0.85x (?)
EqualSubstringSubstringGenericEquatable 25.912 30.594 +18.1% 0.85x (?)
EqualSubstringString 25.963 30.594 +17.8% 0.85x (?)
PrefixWhileAnySequence 191.2 224.5 +17.4% 0.85x (?)
LessSubstringSubstringGenericComparable 26.059 30.594 +17.4% 0.85x (?)
LessSubstringSubstring 26.061 30.594 +17.4% 0.85x (?)
DistinctClassFieldAccesses 37.128 41.467 +11.7% 0.90x (?)
StringComparison_longSharedPrefix 306.429 342.0 +11.6% 0.90x (?)
Set.isStrictSubset.Int.Empty 39.208 43.561 +11.1% 0.90x (?)
DictionaryKeysContainsCocoa 14.324 15.741 +9.9% 0.91x (?)
PrefixWhileSequence 189.6 205.667 +8.5% 0.92x (?)
StringHasSuffixUnicode 69350.0 75157.895 +8.4% 0.92x (?)

IMPROVEMENT OLD NEW DELTA RATIO
String.replaceSubrange.Substring.Small 49.957 39.519 -20.9% 1.26x (?)
StringUTF16SubstringBuilder 1871.111 1667.778 -10.9% 1.12x (?)
Chars2 3814.063 3487.143 -8.6% 1.09x (?)
InsertCharacterTowardsEndIndex 146.417 134.727 -8.0% 1.09x (?)
StringAdder 287.625 268.333 -6.7% 1.07x (?)

------- Performance (x86_64): -Onone -------

REGRESSION OLD NEW DELTA RATIO
StringFromLongWholeSubstringGeneric 15.652 21.71 +38.7% 0.72x (?)
LessSubstringSubstringGenericComparable 27.778 33.652 +21.1% 0.83x (?)
EqualStringSubstring 30.172 35.381 +17.3% 0.85x (?)
EqualSubstringString 30.867 35.563 +15.2% 0.87x (?)
EqualSubstringSubstringGenericEquatable 29.178 33.533 +14.9% 0.87x (?)
EqualSubstringSubstring 30.645 35.083 +14.5% 0.87x (?)
LessSubstringSubstring 30.839 34.971 +13.4% 0.88x (?)
SetSymmetricDifferenceInt100 405.6 441.4 +8.8% 0.92x (?)

IMPROVEMENT OLD NEW DELTA RATIO
String.replaceSubrange.Substring.Small 51.727 41.167 -20.4% 1.26x (?)
InsertCharacterTowardsEndIndex 162.545 150.583 -7.4% 1.08x (?)

@meg-gupta
Copy link
Contributor Author

@swift-ci test windows platform

@meg-gupta
Copy link
Contributor Author

@swift-ci benchmark

@meg-gupta
Copy link
Contributor Author

@swift-ci test

Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of comments... Looks great!

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test and merge

@swift-ci swift-ci merged commit 0c6253e into swiftlang:main Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants