Skip to content

Fix a crash in DeadArgumentTransform #35486

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 1 commit into from
Jan 20, 2021
Merged

Conversation

meg-gupta
Copy link
Contributor

@meg-gupta meg-gupta commented Jan 19, 2021

When there are no non-type dead args, DeadArgumentTransform should not
specialize the function. While marking dead type args as not dead, make
sure we go over all the args.
If not, the following incorrect things happen:

  • the function will be specialized with just dead type args
  • a "dead" type arg with debug uses will be attempted to be deleted in FunctionSignatureTransform::DeadArgumentFinalizeOptimizedFunction.

When there are no non-type dead args, DeadArgumentTransform should not
specialize the function. While marking dead type args as not dead, make
sure we go over all the args.
If not, a dead type arg will be attempted to be deleted later on in
FunctionSignatureTransform::DeadArgumentFinalizeOptimizedFunction.
@meg-gupta meg-gupta changed the title Fix a crash in DeadArgmentTransform Fix a crash in DeadArgumentTransform Jan 19, 2021
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

Running benchmarks to check any code size changes

@meg-gupta
Copy link
Contributor Author

@swift-ci benchmark

@swift-ci
Copy link
Contributor

Performance: -O

Improvement OLD NEW DELTA RATIO
FloatingPointPrinting_Float_description_small 5616 5184 -7.7% 1.08x (?)

Code size: -O

Performance: -Osize

Improvement OLD NEW DELTA RATIO
FlattenListLoop 2514 1629 -35.2% 1.54x (?)
FlattenListFlatMap 6852 5385 -21.4% 1.27x (?)
String.data.Medium 112 97 -13.4% 1.15x (?)
NSStringConversion.MutableCopy.Rebridge.Medium 644 600 -6.8% 1.07x (?)

Code size: -Osize

Performance: -Onone

Regression OLD NEW DELTA RATIO
UTF8Decode_InitFromBytes_ascii_as_ascii 458 519 +13.3% 0.88x (?)
ErrorHandling 4340 4780 +10.1% 0.91x (?)
Dictionary4 989 1065 +7.7% 0.93x (?)
 
Improvement OLD NEW DELTA RATIO
CharIndexing_ascii_unicodeScalars_Backwards 378960 333200 -12.1% 1.14x (?)
CharIndexing_japanese_unicodeScalars_Backwards 465440 409520 -12.0% 1.14x (?)
CharIndexing_tweet_unicodeScalars_Backwards 764520 674600 -11.8% 1.13x (?)
CharIndexing_punctuatedJapanese_unicodeScalars_Backwards 66640 58840 -11.7% 1.13x (?)
CharIndexing_chinese_unicodeScalars_Backwards 288520 255680 -11.4% 1.13x (?)
CharIndexing_punctuated_unicodeScalars_Backwards 85040 75720 -11.0% 1.12x (?)
CharIndexing_korean_unicodeScalars_Backwards 374520 333560 -10.9% 1.12x (?)
CharIndexing_russian_unicodeScalars_Backwards 319240 286640 -10.2% 1.11x (?)
CharIndexing_utf16_unicodeScalars_Backwards 373720 343760 -8.0% 1.09x (?)
StringBuilderWithLongSubstring 5510 5070 -8.0% 1.09x (?)
DictionaryOfAnyHashableStrings_lookup 5232 4848 -7.3% 1.08x (?)

Code size: -swiftlibs

How to read the data The 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
regressions before you merge the PR.

Noise: Sometimes the performance results (not code size!) contain false
alarms. Unexpected regressions which are marked with '(?)' are probably noise.
If you see regressions which you cannot explain you can try to run the
benchmarks again. If regressions still show up, please consult with the
performance team (@eeckstein).

Hardware Overview
  Model Name: Mac Pro
  Model Identifier: MacPro6,1
  Processor Name: 12-Core Intel Xeon E5
  Processor Speed: 2.7 GHz
  Number of Processors: 1
  Total Number of Cores: 12
  L2 Cache (per Core): 256 KB
  L3 Cache: 30 MB
  Memory: 64 GB

@meg-gupta
Copy link
Contributor Author

@swift-ci test Windows Platform

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.

I don't really understand the surrounding code, but this fix looks great.

@meg-gupta meg-gupta merged commit 7bef317 into swiftlang:main Jan 20, 2021
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