Skip to content

Rewrite SILCombiner::propagateConcreteTypeOfInitExistential. #17315

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
Jun 27, 2018
Merged

Rewrite SILCombiner::propagateConcreteTypeOfInitExistential. #17315

merged 1 commit into from
Jun 27, 2018

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Jun 19, 2018

Fixes rdar://40555427 [SR-7773]:
SILCombiner::propagateConcreteTypeOfInitExistential fails to full propagate type
substitutions.

This rewrite fixes several fundamental bugs in the SILCombiner optimization that
propagates concrete types. In particular, the pass needs to handle:

  • Arguments of callee Self type in non-self position.
  • Indirect and direct return values of Self type.
  • Types that indirectly depend on Self within callee function signature.
  • Protocol composition existentials.
  • All of the above need to work for protocol extensions as well as witness methods.
  • For protocol extensions, conformance lookup should be based on the existential's conformance list.

Additionally, the optimization should not depend on a SILFunction's DeclContext,
which is not serialized. (In fact, we should prevent SIL passes from using
DeclContext). Furthermore, the code needs to be expressed in a way that one can
reason about correctness and invariants.

The root cause of these bugs is that SIL passes are written based on untested
assumptions of Swift type system. A SIL pass needs to handle all verifiable SIL
input because passes need to be composable. Bail-out logic can be added to
simplify the design; however, the bail-out logic itself cannot make any
assumptions about the language or type system
that aren't clearly and
explicitly enforced in the SIL verifier. This is a common mistake and major
source of bugs.

I created as many unit tests as I reasonably could to prevent this code from
regressing. Creating enough unit tests to cover all corner cases that were
broken in the original code would be intractable. But the code has been
simplified such that many corner cases disappear.

This opens up some oportunity for generalizing the optimization and eliminating
special cases. However, I want this PR to be limited to fixing correctness
issues only. In the long term, it would be preferable to replace this
optimization entirely with a much more powerful general type propagation pass.

@atrick atrick requested a review from slavapestov June 19, 2018 00:15
@atrick
Copy link
Contributor Author

atrick commented Jun 19, 2018

@slavapestov Normally I would not introduce an optimization rewrite late in a release branch. However, the rewritten code is lower risk than leaving any of the existing code in place. Removing the optimization altogether would introduce the risk of sudden regressions in a release that we don't have time to fix.

The best way to review this I think is to checkout the branch and read through these functions (there's nothing in the original code worth looking at other than what was copied into the ConcreteExistentialInfo constructor):

SILCombiner::createApplyWithConcreteType
SILCombiner::propagateConcreteTypeOfInitExistential(FullApplySite AI, WitnessMethodInst *WMI)
SILCombiner::propagateConcreteTypeOfInitExistential(FullApplySite AI)

@atrick
Copy link
Contributor Author

atrick commented Jun 19, 2018

@rajbarik this might trivially conflict with your PRs. I left findInitExistential in the code for your convenience, but needed to slightly change the signature. If ConcreteExistentialInfo can be used in all cases instead, then we could remove it.

@atrick
Copy link
Contributor Author

atrick commented Jun 19, 2018

@swift-ci test.

@atrick
Copy link
Contributor Author

atrick commented Jun 19, 2018

@swift-ci test source compatibility

@atrick
Copy link
Contributor Author

atrick commented Jun 19, 2018

@swift-ci benchmark.

@swift-ci
Copy link
Contributor

Build comment file:

Optimized (O)

Improvement (1)
TEST OLD NEW DELTA SPEEDUP
UTF8Decode_InitFromBytes_ascii 547 489 -10.6% 1.12x (?)
No Changes (445)
TEST OLD NEW DELTA SPEEDUP
AngryPhonebook 3612 3619 +0.2% 1.00x (?)
AnyHashableWithAClass 86569 86493 -0.1% 1.00x (?)
Array2D 2819 2817 -0.1% 1.00x (?)
ArrayAppend 1067 1072 +0.5% 1.00x (?)
ArrayAppendArrayOfInt 792 792 +0.0% 1.00x
ArrayAppendAscii 3881 3888 +0.2% 1.00x (?)
ArrayAppendAsciiSubstring 24316 24318 +0.0% 1.00x (?)
ArrayAppendFromGeneric 800 785 -1.9% 1.02x (?)
ArrayAppendGenericStructs 1406 1400 -0.4% 1.00x (?)
ArrayAppendLatin1 41552 41559 +0.0% 1.00x (?)
ArrayAppendLatin1Substring 141550 141557 +0.0% 1.00x (?)
ArrayAppendLazyMap 1342 1340 -0.1% 1.00x (?)
ArrayAppendOptionals 1427 1422 -0.4% 1.00x (?)
ArrayAppendRepeatCol 1337 1337 +0.0% 1.00x
ArrayAppendReserved 804 806 +0.2% 1.00x (?)
ArrayAppendSequence 1122 1123 +0.1% 1.00x (?)
ArrayAppendStrings 6216 6206 -0.2% 1.00x (?)
ArrayAppendToFromGeneric 795 784 -1.4% 1.01x (?)
ArrayAppendToGeneric 790 799 +1.1% 0.99x (?)
ArrayAppendUTF16 41483 41494 +0.0% 1.00x (?)
ArrayAppendUTF16Substring 139274 139208 -0.0% 1.00x (?)
ArrayInClass 85 85 +0.0% 1.00x
ArrayLiteral 0 0 +0.0% 1.00x
ArrayOfGenericPOD2 151 151 +0.0% 1.00x
ArrayOfGenericRef 4389 4387 -0.0% 1.00x (?)
ArrayOfPOD 184 184 +0.0% 1.00x
ArrayOfRef 4361 4361 +0.0% 1.00x
ArrayPlusEqualArrayOfInt 796 796 +0.0% 1.00x
ArrayPlusEqualFiveElementCollection 5481 5497 +0.3% 1.00x (?)
ArrayPlusEqualSingleElementCollection 1071 1066 -0.5% 1.00x (?)
ArrayPlusEqualThreeElements 1641 1640 -0.1% 1.00x (?)
ArraySubscript 1512 1516 +0.3% 1.00x (?)
ArrayValueProp 8 8 +0.0% 1.00x
ArrayValueProp2 8 8 +0.0% 1.00x
ArrayValueProp3 8 8 +0.0% 1.00x
ArrayValueProp4 8 8 +0.0% 1.00x
BinaryFloatingPointPropertiesBinade 31 31 +0.0% 1.00x
BinaryFloatingPointPropertiesNextUp 28 28 +0.0% 1.00x
BinaryFloatingPointPropertiesUlp 37 37 +0.0% 1.00x
BitCount 211 211 +0.0% 1.00x
ByteSwap 101 101 +0.0% 1.00x
COWArrayGuaranteedParameterOverhead 8550 8546 -0.0% 1.00x (?)
COWTree 5273 5283 +0.2% 1.00x (?)
CSVParsing 655318 655320 +0.0% 1.00x (?)
CSVParsingAlt 805801 806352 +0.1% 1.00x (?)
CSVParsingAltIndices 336298 334704 -0.5% 1.00x (?)
CStringLongAscii 4193 4195 +0.0% 1.00x (?)
CStringLongNonAscii 2488 2508 +0.8% 0.99x (?)
CStringShortAscii 3314 3311 -0.1% 1.00x (?)
Calculator 193 193 +0.0% 1.00x
CaptureProp 4097 4104 +0.2% 1.00x (?)
ChainedFilterMap 1408 1407 -0.1% 1.00x (?)
CharIndexing_ascii_unicodeScalars 16958 16958 +0.0% 1.00x
CharIndexing_ascii_unicodeScalars_Backwards 16005 16005 +0.0% 1.00x
CharIndexing_chinese_unicodeScalars 12844 12847 +0.0% 1.00x (?)
CharIndexing_chinese_unicodeScalars_Backwards 12128 12126 -0.0% 1.00x (?)
CharIndexing_japanese_unicodeScalars 20316 20301 -0.1% 1.00x (?)
CharIndexing_japanese_unicodeScalars_Backwards 19171 19164 -0.0% 1.00x (?)
CharIndexing_korean_unicodeScalars 16443 16454 +0.1% 1.00x (?)
CharIndexing_korean_unicodeScalars_Backwards 15523 15523 +0.0% 1.00x
CharIndexing_punctuatedJapanese_unicodeScalars 3065 3065 +0.0% 1.00x
CharIndexing_punctuatedJapanese_unicodeScalars_Backwards 2910 2909 -0.0% 1.00x (?)
CharIndexing_punctuated_unicodeScalars 3834 3835 +0.0% 1.00x (?)
CharIndexing_punctuated_unicodeScalars_Backwards 3622 3617 -0.1% 1.00x (?)
CharIndexing_russian_unicodeScalars 14128 14128 +0.0% 1.00x
CharIndexing_russian_unicodeScalars_Backwards 13344 13354 +0.1% 1.00x (?)
CharIndexing_tweet_unicodeScalars 32753 32727 -0.1% 1.00x (?)
CharIndexing_tweet_unicodeScalars_Backwards 31210 31219 +0.0% 1.00x (?)
CharIndexing_utf16_unicodeScalars 23617 23031 -2.5% 1.03x (?)
CharIndexing_utf16_unicodeScalars_Backwards 23347 23221 -0.5% 1.01x (?)
CharIteration_ascii_unicodeScalars 21307 21287 -0.1% 1.00x (?)
CharIteration_ascii_unicodeScalars_Backwards 15136 15136 +0.0% 1.00x
CharIteration_chinese_unicodeScalars 16153 16141 -0.1% 1.00x (?)
CharIteration_chinese_unicodeScalars_Backwards 11464 11467 +0.0% 1.00x (?)
CharIteration_japanese_unicodeScalars 25509 25526 +0.1% 1.00x (?)
CharIteration_japanese_unicodeScalars_Backwards 18118 18122 +0.0% 1.00x (?)
CharIteration_korean_unicodeScalars 20650 20665 +0.1% 1.00x (?)
CharIteration_korean_unicodeScalars_Backwards 14675 14676 +0.0% 1.00x (?)
CharIteration_punctuatedJapanese_unicodeScalars 3845 3846 +0.0% 1.00x (?)
CharIteration_punctuatedJapanese_unicodeScalars_Backwards 2746 2746 +0.0% 1.00x
CharIteration_punctuated_unicodeScalars 4818 4818 +0.0% 1.00x
CharIteration_punctuated_unicodeScalars_Backwards 3434 3434 +0.0% 1.00x
CharIteration_russian_unicodeScalars 17750 17745 -0.0% 1.00x (?)
CharIteration_russian_unicodeScalars_Backwards 12613 12610 -0.0% 1.00x (?)
CharIteration_tweet_unicodeScalars 41990 42007 +0.0% 1.00x (?)
CharIteration_tweet_unicodeScalars_Backwards 29950 29950 +0.0% 1.00x
CharIteration_utf16_unicodeScalars 28054 28065 +0.0% 1.00x (?)
CharIteration_utf16_unicodeScalars_Backwards 18785 18784 -0.0% 1.00x (?)
CharacterLiteralsLarge 5877 5881 +0.1% 1.00x (?)
CharacterLiteralsSmall 217 217 +0.0% 1.00x
CharacterPropertiesFetch 4566 4579 +0.3% 1.00x (?)
CharacterPropertiesPrecomputed 1038 1036 -0.2% 1.00x (?)
CharacterPropertiesStashed 1522 1521 -0.1% 1.00x (?)
CharacterPropertiesStashedMemo 1586 1583 -0.2% 1.00x (?)
Chars 913 914 +0.1% 1.00x (?)
ClassArrayGetter 15 15 +0.0% 1.00x
Combos 524 523 -0.2% 1.00x (?)
DataAccessBytes 1145 1146 +0.1% 1.00x (?)
DataAppendArray 5139 5165 +0.5% 0.99x (?)
DataAppendBytes 4917 4887 -0.6% 1.01x (?)
DataAppendDataLargeToLarge 66948 67001 +0.1% 1.00x (?)
DataAppendDataLargeToMedium 35092 35244 +0.4% 1.00x (?)
DataAppendDataLargeToSmall 34284 34474 +0.6% 0.99x (?)
DataAppendDataMediumToLarge 37598 37361 -0.6% 1.01x (?)
DataAppendDataMediumToMedium 6452 6406 -0.7% 1.01x (?)
DataAppendDataMediumToSmall 5809 5834 +0.4% 1.00x (?)
DataAppendDataSmallToLarge 36893 36815 -0.2% 1.00x (?)
DataAppendDataSmallToMedium 5947 5953 +0.1% 1.00x (?)
DataAppendDataSmallToSmall 5830 5655 -3.0% 1.03x (?)
DataAppendSequence 20452 20600 +0.7% 0.99x (?)
DataCopyBytes 436 434 -0.5% 1.00x (?)
DataCount 34 34 +0.0% 1.00x
DataMutateBytes 3832 3820 -0.3% 1.00x (?)
DataReplaceLarge 36493 37056 +1.5% 0.98x (?)
DataReplaceLargeBuffer 57133 57409 +0.5% 1.00x (?)
DataReplaceMedium 7604 7675 +0.9% 0.99x (?)
DataReplaceMediumBuffer 11245 11360 +1.0% 0.99x (?)
DataReplaceSmall 5735 5744 +0.2% 1.00x (?)
DataReplaceSmallBuffer 8656 8557 -1.1% 1.01x (?)
DataReset 2791 2796 +0.2% 1.00x (?)
DataSetCount 549 549 +0.0% 1.00x
DataSubscript 220 220 +0.0% 1.00x
DictOfArraysToArrayOfDicts 777 787 +1.3% 0.99x (?)
Dictionary 509 510 +0.2% 1.00x (?)
Dictionary2 636 637 +0.2% 1.00x (?)
Dictionary2OfObjects 2076 2071 -0.2% 1.00x (?)
Dictionary3 221 220 -0.5% 1.00x (?)
Dictionary3OfObjects 733 733 +0.0% 1.00x
Dictionary4 343 343 +0.0% 1.00x
Dictionary4Legacy 745 746 +0.1% 1.00x (?)
Dictionary4OfObjects 454 454 +0.0% 1.00x
Dictionary4OfObjectsLegacy 959 958 -0.1% 1.00x (?)
DictionaryBridge 1154 1162 +0.7% 0.99x (?)
DictionaryCopy 106593 106717 +0.1% 1.00x (?)
DictionaryFilter 105559 106277 +0.7% 0.99x (?)
DictionaryGroup 215 215 +0.0% 1.00x
DictionaryGroupOfObjects 2115 2114 -0.0% 1.00x (?)
DictionaryKeysContainsCocoa 39 39 +0.0% 1.00x
DictionaryKeysContainsNative 32 32 +0.0% 1.00x
DictionaryLiteral 1922 1921 -0.1% 1.00x (?)
DictionaryOfObjects 2359 2360 +0.0% 1.00x (?)
DictionaryRemove 4167 4173 +0.1% 1.00x (?)
DictionaryRemoveOfObjects 25723 25720 -0.0% 1.00x (?)
DictionarySubscriptDefaultMutation 270 270 +0.0% 1.00x
DictionarySubscriptDefaultMutationArray 602 603 +0.2% 1.00x (?)
DictionarySubscriptDefaultMutationArrayOfObjects 4009 4005 -0.1% 1.00x (?)
DictionarySubscriptDefaultMutationOfObjects 1697 1697 +0.0% 1.00x
DictionarySwap 1033 1033 +0.0% 1.00x
DictionarySwapAt 6603 6621 +0.3% 1.00x (?)
DictionarySwapAtOfObjects 52244 52262 +0.0% 1.00x (?)
DictionarySwapOfObjects 8755 8766 +0.1% 1.00x (?)
DoubleWidthDivision 0 0 +0.0% 1.00x
DropFirstAnyCollection 83 83 +0.0% 1.00x
DropFirstAnyCollectionLazy 65108 65219 +0.2% 1.00x (?)
DropFirstAnySeqCRangeIter 21464 21486 +0.1% 1.00x (?)
DropFirstAnySeqCRangeIterLazy 21497 21510 +0.1% 1.00x (?)
DropFirstAnySeqCntRange 41 41 +0.0% 1.00x
DropFirstAnySeqCntRangeLazy 41 41 +0.0% 1.00x
DropFirstAnySequence 5034 5033 -0.0% 1.00x (?)
DropFirstAnySequenceLazy 5038 5037 -0.0% 1.00x (?)
DropFirstArray 35 35 +0.0% 1.00x
DropFirstArrayLazy 35 35 +0.0% 1.00x
DropFirstCountableRange 35 35 +0.0% 1.00x
DropFirstCountableRangeLazy 35 35 +0.0% 1.00x
DropFirstSequence 2680 2680 +0.0% 1.00x
DropFirstSequenceLazy 2768 2768 +0.0% 1.00x
DropLastAnyCollection 30 31 +3.3% 0.97x
DropLastAnyCollectionLazy 21757 21752 -0.0% 1.00x (?)
DropLastAnySeqCRangeIter 3517 3525 +0.2% 1.00x (?)
DropLastAnySeqCRangeIterLazy 3517 3518 +0.0% 1.00x (?)
DropLastAnySeqCntRange 13 13 +0.0% 1.00x
DropLastAnySeqCntRangeLazy 13 13 +0.0% 1.00x
DropLastAnySequence 4905 4910 +0.1% 1.00x (?)
DropLastAnySequenceLazy 5006 5007 +0.0% 1.00x (?)
DropLastCountableRange 11 11 +0.0% 1.00x
DropLastCountableRangeLazy 12 12 +0.0% 1.00x
DropLastSequence 658 658 +0.0% 1.00x
DropLastSequenceLazy 658 657 -0.2% 1.00x (?)
DropWhileAnyCollection 107 107 +0.0% 1.00x
DropWhileAnyCollectionLazy 125 125 +0.0% 1.00x
DropWhileAnySeqCRangeIter 16912 16929 +0.1% 1.00x (?)
DropWhileAnySeqCRangeIterLazy 125 125 +0.0% 1.00x
DropWhileAnySeqCntRange 50 50 +0.0% 1.00x
DropWhileAnySeqCntRangeLazy 125 125 +0.0% 1.00x
DropWhileAnySequence 4832 4831 -0.0% 1.00x (?)
DropWhileAnySequenceLazy 1856 1856 +0.0% 1.00x
DropWhileArrayLazy 88 88 +0.0% 1.00x
DropWhileCountableRange 36 36 +0.0% 1.00x
DropWhileCountableRangeLazy 105 105 +0.0% 1.00x
DropWhileSequence 2209 2209 +0.0% 1.00x
DropWhileSequenceLazy 88 88 +0.0% 1.00x
EqualStringSubstring 48 48 +0.0% 1.00x
EqualSubstringString 48 48 +0.0% 1.00x
EqualSubstringSubstring 48 48 +0.0% 1.00x
EqualSubstringSubstringGenericEquatable 48 48 +0.0% 1.00x
ErrorHandling 1191 1186 -0.4% 1.00x (?)
ExclusivityGlobal 5 5 +0.0% 1.00x
ExclusivityIndependent 2 2 +0.0% 1.00x
FatCompactMap 198048 198012 -0.0% 1.00x (?)
FilterEvenUsingReduce 1298 1291 -0.5% 1.01x (?)
FilterEvenUsingReduceInto 148 149 +0.7% 0.99x (?)
FloatingPointPrinting_Double_description_small 21374 21378 +0.0% 1.00x (?)
FloatingPointPrinting_Double_description_uniform 20985 21019 +0.2% 1.00x (?)
FloatingPointPrinting_Double_interpolated 61656 61686 +0.0% 1.00x (?)
FloatingPointPrinting_Float80_description_small 28222 28223 +0.0% 1.00x (?)
FloatingPointPrinting_Float80_description_uniform 27463 27470 +0.0% 1.00x (?)
FloatingPointPrinting_Float80_interpolated 64975 64969 -0.0% 1.00x (?)
FloatingPointPrinting_Float_description_small 5369 5367 -0.0% 1.00x (?)
FloatingPointPrinting_Float_description_uniform 5290 5294 +0.1% 1.00x (?)
FloatingPointPrinting_Float_interpolated 38668 38707 +0.1% 1.00x (?)
FrequenciesUsingReduce 4911 4906 -0.1% 1.00x (?)
FrequenciesUsingReduceInto 1523 1523 +0.0% 1.00x
Hanoi 2225 2229 +0.2% 1.00x (?)
HashTest 930 928 -0.2% 1.00x (?)
Histogram 715 718 +0.4% 1.00x (?)
Integrate 335 335 +0.0% 1.00x
IterateData 1540 1540 +0.0% 1.00x
Join 174 174 +0.0% 1.00x
LazilyFilteredArrayContains 35454 35454 +0.0% 1.00x
LazilyFilteredArrays 64724 64484 -0.4% 1.00x (?)
LazilyFilteredRange 3864 3868 +0.1% 1.00x (?)
LessSubstringSubstring 48 48 +0.0% 1.00x
LessSubstringSubstringGenericComparable 48 48 +0.0% 1.00x
LinkedList 7549 7540 -0.1% 1.00x (?)
LuhnAlgoEager 448 446 -0.4% 1.00x (?)
LuhnAlgoLazy 448 448 +0.0% 1.00x
MapReduce 398 397 -0.3% 1.00x (?)
MapReduceAnyCollection 428 428 +0.0% 1.00x
MapReduceAnyCollectionShort 2232 2231 -0.0% 1.00x (?)
MapReduceClass 3005 3004 -0.0% 1.00x (?)
MapReduceClassShort 4719 4553 -3.5% 1.04x (?)
MapReduceLazyCollection 13 13 +0.0% 1.00x
MapReduceLazyCollectionShort 37 36 -2.7% 1.03x (?)
MapReduceLazySequence 86 86 +0.0% 1.00x
MapReduceSequence 454 452 -0.4% 1.00x (?)
MapReduceShort 1984 1983 -0.1% 1.00x (?)
MapReduceShortString 20 20 +0.0% 1.00x
MapReduceString 48 48 +0.0% 1.00x
Memset 215 216 +0.5% 1.00x (?)
MonteCarloE 10193 10188 -0.0% 1.00x (?)
MonteCarloPi 42683 42685 +0.0% 1.00x (?)
NSDictionaryCastToSwift 6650 6696 +0.7% 0.99x (?)
NSError 165 165 +0.0% 1.00x
NSStringConversion 734 733 -0.1% 1.00x (?)
NibbleSort 3695 3695 +0.0% 1.00x
NopDeinit 30150 30153 +0.0% 1.00x (?)
ObjectAllocation 132 132 +0.0% 1.00x
ObjectiveCBridgeFromNSArrayAnyObject 24713 25182 +1.9% 0.98x (?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 4599 4651 +1.1% 0.99x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 45689 44065 -3.6% 1.04x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 44320 43843 -1.1% 1.01x (?)
ObjectiveCBridgeFromNSDictionaryAnyObject 109664 111480 +1.7% 0.98x (?)
ObjectiveCBridgeFromNSSetAnyObject 47687 47609 -0.2% 1.00x (?)
ObjectiveCBridgeFromNSSetAnyObjectForced 4930 5016 +1.7% 0.98x (?)
ObjectiveCBridgeFromNSSetAnyObjectToString 68227 68950 +1.1% 0.99x (?)
ObjectiveCBridgeFromNSString 1209 1206 -0.2% 1.00x (?)
ObjectiveCBridgeFromNSStringForced 2675 2658 -0.6% 1.01x (?)
ObjectiveCBridgeStubDataAppend 6319 6270 -0.8% 1.01x (?)
ObjectiveCBridgeStubDateMutation 400 400 +0.0% 1.00x
ObjectiveCBridgeStubFromArrayOfNSString 32996 33739 +2.3% 0.98x (?)
ObjectiveCBridgeStubFromNSDate 6288 6293 +0.1% 1.00x (?)
ObjectiveCBridgeStubFromNSString 1021 1024 +0.3% 1.00x (?)
ObjectiveCBridgeStubFromNSStringRef 161 161 +0.0% 1.00x
ObjectiveCBridgeStubNSDataAppend 2539 2531 -0.3% 1.00x (?)
ObjectiveCBridgeStubNSDateMutationRef 12964 13047 +0.6% 0.99x (?)
ObjectiveCBridgeStubToArrayOfNSString 39334 39580 +0.6% 0.99x (?)
ObjectiveCBridgeStubToNSDate 14787 15115 +2.2% 0.98x (?)
ObjectiveCBridgeStubToNSDateRef 3430 3425 -0.1% 1.00x (?)
ObjectiveCBridgeStubToNSString 2339 2339 +0.0% 1.00x
ObjectiveCBridgeStubToNSStringRef 115 115 +0.0% 1.00x
ObjectiveCBridgeStubURLAppendPath 278511 275014 -1.3% 1.01x (?)
ObjectiveCBridgeStubURLAppendPathRef 270781 274384 +1.3% 0.99x (?)
ObjectiveCBridgeToNSArray 14333 14482 +1.0% 0.99x (?)
ObjectiveCBridgeToNSDictionary 26518 25934 -2.2% 1.02x (?)
ObjectiveCBridgeToNSSet 17330 17015 -1.8% 1.02x (?)
ObjectiveCBridgeToNSString 447 446 -0.2% 1.00x (?)
ObserverClosure 2154 2153 -0.0% 1.00x (?)
ObserverForwarderStruct 1212 1211 -0.1% 1.00x (?)
ObserverPartiallyAppliedMethod 3704 3704 +0.0% 1.00x
ObserverUnappliedMethod 2454 2456 +0.1% 1.00x (?)
OpaqueConsumingUsers 4178 4178 +0.0% 1.00x
OpenClose 65 65 +0.0% 1.00x
PartialApplyDynamicType 0 0 +0.0% 1.00x
Phonebook 6910 6911 +0.0% 1.00x (?)
PointerArithmetics 34337 34333 -0.0% 1.00x (?)
PolymorphicCalls 25 25 +0.0% 1.00x
PopFrontArray 1891 1960 +3.6% 0.96x (?)
PopFrontArrayGeneric 1977 1975 -0.1% 1.00x (?)
PopFrontUnsafePointer 9111 8736 -4.1% 1.04x (?)
PrefixAnyCollection 83 83 +0.0% 1.00x
PrefixAnyCollectionLazy 65412 65349 -0.1% 1.00x (?)
PrefixAnySeqCRangeIter 16711 16711 +0.0% 1.00x
PrefixAnySeqCRangeIterLazy 16677 16672 -0.0% 1.00x (?)
PrefixAnySeqCntRange 28 28 +0.0% 1.00x
PrefixAnySeqCntRangeLazy 28 28 +0.0% 1.00x
PrefixAnySequence 4324 4324 +0.0% 1.00x
PrefixAnySequenceLazy 4323 4323 +0.0% 1.00x
PrefixArray 35 35 +0.0% 1.00x
PrefixArrayLazy 35 35 +0.0% 1.00x
PrefixCountableRange 35 35 +0.0% 1.00x
PrefixCountableRangeLazy 35 35 +0.0% 1.00x
PrefixSequence 2214 2215 +0.0% 1.00x (?)
PrefixSequenceLazy 2275 2275 +0.0% 1.00x
PrefixWhileAnyCollection 154 154 +0.0% 1.00x
PrefixWhileAnyCollectionLazy 90 90 +0.0% 1.00x
PrefixWhileAnySeqCRangeIter 8669 8656 -0.1% 1.00x (?)
PrefixWhileAnySeqCRangeIterLazy 72 72 +0.0% 1.00x
PrefixWhileAnySeqCntRange 59 59 +0.0% 1.00x
PrefixWhileAnySeqCntRangeLazy 90 90 +0.0% 1.00x
PrefixWhileAnySequence 9766 9787 +0.2% 1.00x (?)
PrefixWhileAnySequenceLazy 1392 1392 +0.0% 1.00x
PrefixWhileArray 88 88 +0.0% 1.00x
PrefixWhileArrayLazy 70 70 +0.0% 1.00x
PrefixWhileCountableRange 36 36 +0.0% 1.00x
PrefixWhileCountableRangeLazy 35 35 +0.0% 1.00x
PrefixWhileSequence 361 361 +0.0% 1.00x
PrefixWhileSequenceLazy 52 52 +0.0% 1.00x
Prims 899 898 -0.1% 1.00x (?)
PrimsSplit 899 895 -0.4% 1.00x (?)
QueueConcrete 1149 1148 -0.1% 1.00x (?)
QueueGeneric 1147 1147 +0.0% 1.00x
RC4 161 161 +0.0% 1.00x
RGBHistogram 3204 3205 +0.0% 1.00x (?)
RGBHistogramOfObjects 23671 23699 +0.1% 1.00x (?)
Radix2CooleyTukey 12234 12443 +1.7% 0.98x (?)
Radix2CooleyTukeyf 8909 8906 -0.0% 1.00x (?)
RandomDoubleDef 26705 26665 -0.1% 1.00x (?)
RandomDoubleLCG 2895 2895 +0.0% 1.00x
RandomIntegersDef 24690 24714 +0.1% 1.00x (?)
RandomIntegersLCG 994 994 +0.0% 1.00x
RandomShuffleDef 811561 812034 +0.1% 1.00x (?)
RandomShuffleLCG 119449 119225 -0.2% 1.00x (?)
RangeAssignment 350 350 +0.0% 1.00x
RangeIterationSigned 171 171 +0.0% 1.00x
RangeReplaceableCollectionPlusDefault 1004 1004 +0.0% 1.00x
RecursiveOwnedParameter 115 115 +0.0% 1.00x
RemoveWhereFilterInts 47 47 +0.0% 1.00x
RemoveWhereFilterString 249 249 +0.0% 1.00x
RemoveWhereFilterStrings 437 436 -0.2% 1.00x (?)
RemoveWhereMoveInts 15 15 +0.0% 1.00x
RemoveWhereMoveStrings 708 708 +0.0% 1.00x
RemoveWhereQuadraticInts 1295 1295 +0.0% 1.00x
RemoveWhereQuadraticString 373 373 +0.0% 1.00x
RemoveWhereQuadraticStrings 2761 2760 -0.0% 1.00x (?)
RemoveWhereSwapInts 19 19 +0.0% 1.00x
RemoveWhereSwapStrings 860 860 +0.0% 1.00x
ReversedArray 57 57 +0.0% 1.00x
ReversedBidirectional 16534 16525 -0.1% 1.00x (?)
ReversedDictionary 263 262 -0.4% 1.00x (?)
RomanNumbers 86467 86465 -0.0% 1.00x (?)
SequenceAlgosAnySequence 11910 11911 +0.0% 1.00x (?)
SequenceAlgosArray 1577 1563 -0.9% 1.01x (?)
SequenceAlgosContiguousArray 1574 1571 -0.2% 1.00x (?)
SequenceAlgosList 1356 1356 +0.0% 1.00x
SequenceAlgosRange 2576 2576 +0.0% 1.00x
SequenceAlgosUnfoldSequence 1101 1102 +0.1% 1.00x (?)
SetExclusiveOr 4971 4957 -0.3% 1.00x (?)
SetExclusiveOr_OfObjects 11659 11649 -0.1% 1.00x (?)
SetIntersect 700 697 -0.4% 1.00x (?)
SetIntersect_OfObjects 1745 1742 -0.2% 1.00x (?)
SetIsSubsetOf 345 344 -0.3% 1.00x (?)
SetIsSubsetOf_OfObjects 440 440 +0.0% 1.00x
SetUnion 4360 4362 +0.0% 1.00x (?)
SetUnion_OfObjects 10043 10058 +0.1% 1.00x (?)
SevenBoom 836 835 -0.1% 1.00x (?)
Sim2DArray 417 417 +0.0% 1.00x
SortLargeExistentials 5494 5497 +0.1% 1.00x (?)
SortLettersInPlace 993 989 -0.4% 1.00x (?)
SortSortedStrings 870 872 +0.2% 1.00x (?)
SortStrings 1831 1830 -0.1% 1.00x (?)
SortStringsUnicode 2522 2523 +0.0% 1.00x (?)
StackPromo 24954 24958 +0.0% 1.00x (?)
StaticArray 9 9 +0.0% 1.00x
StrComplexWalk 1781 1780 -0.1% 1.00x (?)
StrToInt 3213 3210 -0.1% 1.00x (?)
StringAdder 567 567 +0.0% 1.00x
StringBuilder 473 473 +0.0% 1.00x
StringBuilderLong 1244 1242 -0.2% 1.00x (?)
StringBuilderSmallReservingCapacity 493 493 +0.0% 1.00x
StringBuilderWithLongSubstring 1442 1447 +0.3% 1.00x (?)
StringComparison_abnormal 845 845 +0.0% 1.00x
StringComparison_ascii 1054 1058 +0.4% 1.00x (?)
StringComparison_emoji 859 860 +0.1% 1.00x (?)
StringComparison_fastPrenormal 851 851 +0.0% 1.00x
StringComparison_latin1 666 666 +0.0% 1.00x
StringComparison_longSharedPrefix 960 960 +0.0% 1.00x
StringComparison_nonBMPSlowestPrenormal 1688 1688 +0.0% 1.00x
StringComparison_slowerPrenormal 1833 1833 +0.0% 1.00x
StringComparison_zalgo 120138 120298 +0.1% 1.00x (?)
StringEdits 170327 170302 -0.0% 1.00x (?)
StringEnumRawValueInitialization 859 859 +0.0% 1.00x
StringEqualPointerComparison 286 286 +0.0% 1.00x
StringFromLongWholeSubstring 22 22 +0.0% 1.00x
StringFromLongWholeSubstringGeneric 21 21 +0.0% 1.00x
StringHasPrefixAscii 2232 2232 +0.0% 1.00x
StringHasPrefixUnicode 118463 118395 -0.1% 1.00x (?)
StringHasSuffixAscii 2347 2347 +0.0% 1.00x
StringHasSuffixUnicode 112891 113368 +0.4% 1.00x (?)
StringInterpolation 9048 9155 +1.2% 0.99x (?)
StringInterpolationManySmallSegments 18109 18219 +0.6% 0.99x (?)
StringInterpolationSmall 4313 4313 +0.0% 1.00x
StringMatch 13489 13490 +0.0% 1.00x (?)
StringRemoveDupes 491 491 +0.0% 1.00x
StringUTF16Builder 2642 2659 +0.6% 0.99x (?)
StringUTF16SubstringBuilder 5874 5807 -1.1% 1.01x (?)
StringWalk 1559 1560 +0.1% 1.00x (?)
StringWithCString 44812 44805 -0.0% 1.00x (?)
StringWordBuilder 2256 2248 -0.4% 1.00x (?)
StringWordBuilderReservingCapacity 1876 1871 -0.3% 1.00x (?)
SubstringComparable 13 13 +0.0% 1.00x
SubstringEqualString 605 607 +0.3% 1.00x (?)
SubstringEquatable 1421 1422 +0.1% 1.00x (?)
SubstringFromLongString 10 10 +0.0% 1.00x
SubstringFromLongStringGeneric 74 74 +0.0% 1.00x
SuffixAnyCollection 30 31 +3.3% 0.97x
SuffixAnyCollectionLazy 21775 21773 -0.0% 1.00x (?)
SuffixAnySeqCRangeIter 3735 3728 -0.2% 1.00x (?)
SuffixAnySeqCRangeIterLazy 3735 3730 -0.1% 1.00x (?)
SuffixAnySeqCntRange 20 20 +0.0% 1.00x
SuffixAnySeqCntRangeLazy 20 20 +0.0% 1.00x
SuffixAnySequence 4898 4911 +0.3% 1.00x (?)
SuffixAnySequenceLazy 4980 4977 -0.1% 1.00x (?)
SuffixCountableRange 11 11 +0.0% 1.00x
SuffixCountableRangeLazy 11 11 +0.0% 1.00x
SuffixSequence 3579 3575 -0.1% 1.00x (?)
SuffixSequenceLazy 3578 3582 +0.1% 1.00x (?)
SumUsingReduce 97 97 +0.0% 1.00x
SumUsingReduceInto 97 97 +0.0% 1.00x
SuperChars 24810 24810 +0.0% 1.00x
TwoSum 1469 1470 +0.1% 1.00x (?)
TypeFlood 0 0 +0.0% 1.00x
UTF8Decode 310 310 +0.0% 1.00x
UTF8Decode_InitDecoding 1348 1350 +0.1% 1.00x (?)
UTF8Decode_InitDecoding_ascii 651 651 +0.0% 1.00x
UTF8Decode_InitFromBytes 1178 1185 +0.6% 0.99x (?)
UTF8Decode_InitFromData 1250 1247 -0.2% 1.00x (?)
UTF8Decode_InitFromData_ascii 700 695 -0.7% 1.01x (?)
Walsh 424 424 +0.0% 1.00x
WordCountHistogramASCII 8119 8124 +0.1% 1.00x (?)
WordCountHistogramUTF16 14092 14005 -0.6% 1.01x (?)
WordCountUniqueASCII 2082 2089 +0.3% 1.00x (?)
WordCountUniqueUTF16 7294 7260 -0.5% 1.00x (?)
WordSplitASCII 8230 8262 +0.4% 1.00x (?)
WordSplitUTF16 10039 10248 +2.1% 0.98x (?)
XorLoop 401 399 -0.5% 1.01x (?)

Unoptimized (Onone)

Regression (7)
TEST OLD NEW DELTA SPEEDUP
UTF8Decode_InitFromData_ascii 710 858 +20.8% 0.83x (?)
ObjectiveCBridgeStubFromArrayOfNSString 32704 38348 +17.3% 0.85x (?)
StringBuilderLong 1414 1622 +14.7% 0.87x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 45486 51364 +12.9% 0.89x (?)
DictionaryKeysContainsNative 52 56 +7.7% 0.93x (?)
DataReplaceMediumBuffer 11478 12191 +6.2% 0.94x (?)
DataCopyBytes 449 475 +5.8% 0.95x (?)
Improvement (4)
TEST OLD NEW DELTA SPEEDUP
CharIndexing_japanese_unicodeScalars 406004 378444 -6.8% 1.07x (?)
TypeFlood 207 193 -6.8% 1.07x (?)
ObjectiveCBridgeFromNSSetAnyObject 55243 52393 -5.2% 1.05x (?)
FloatingPointPrinting_Double_interpolated 103788 98673 -4.9% 1.05x
No Changes (435)
TEST OLD NEW DELTA SPEEDUP
AngryPhonebook 5051 5053 +0.0% 1.00x (?)
AnyHashableWithAClass 104822 104961 +0.1% 1.00x (?)
Array2D 619543 615218 -0.7% 1.01x (?)
ArrayAppend 4436 4440 +0.1% 1.00x (?)
ArrayAppendArrayOfInt 860 858 -0.2% 1.00x (?)
ArrayAppendAscii 25670 25932 +1.0% 0.99x (?)
ArrayAppendAsciiSubstring 69838 69870 +0.0% 1.00x (?)
ArrayAppendFromGeneric 866 868 +0.2% 1.00x (?)
ArrayAppendGenericStructs 1496 1499 +0.2% 1.00x (?)
ArrayAppendLatin1 64279 64203 -0.1% 1.00x (?)
ArrayAppendLatin1Substring 158913 159206 +0.2% 1.00x (?)
ArrayAppendLazyMap 165139 165529 +0.2% 1.00x (?)
ArrayAppendOptionals 1500 1496 -0.3% 1.00x (?)
ArrayAppendRepeatCol 187208 187302 +0.1% 1.00x (?)
ArrayAppendReserved 4163 4165 +0.0% 1.00x (?)
ArrayAppendSequence 103621 103605 -0.0% 1.00x (?)
ArrayAppendStrings 6376 6344 -0.5% 1.01x (?)
ArrayAppendToFromGeneric 865 866 +0.1% 1.00x (?)
ArrayAppendToGeneric 869 871 +0.2% 1.00x (?)
ArrayAppendUTF16 64397 64324 -0.1% 1.00x (?)
ArrayAppendUTF16Substring 157232 157386 +0.1% 1.00x (?)
ArrayInClass 6224 6228 +0.1% 1.00x (?)
ArrayLiteral 1783 1785 +0.1% 1.00x (?)
ArrayOfGenericPOD2 1128 1128 +0.0% 1.00x
ArrayOfGenericRef 10524 10516 -0.1% 1.00x (?)
ArrayOfPOD 761 761 +0.0% 1.00x
ArrayOfRef 9627 9653 +0.3% 1.00x (?)
ArrayPlusEqualArrayOfInt 864 860 -0.5% 1.00x (?)
ArrayPlusEqualFiveElementCollection 220176 220326 +0.1% 1.00x (?)
ArrayPlusEqualSingleElementCollection 218729 217255 -0.7% 1.01x (?)
ArrayPlusEqualThreeElements 8745 8750 +0.1% 1.00x (?)
ArraySubscript 107715 107769 +0.1% 1.00x (?)
ArrayValueProp 3630 3621 -0.2% 1.00x (?)
ArrayValueProp2 14906 14865 -0.3% 1.00x (?)
ArrayValueProp3 4147 4160 +0.3% 1.00x (?)
ArrayValueProp4 4084 4085 +0.0% 1.00x (?)
BinaryFloatingPointPropertiesBinade 88 88 +0.0% 1.00x
BinaryFloatingPointPropertiesNextUp 132 132 +0.0% 1.00x
BinaryFloatingPointPropertiesUlp 137 137 +0.0% 1.00x
BitCount 8731 8729 -0.0% 1.00x (?)
ByteSwap 9754 9723 -0.3% 1.00x (?)
COWArrayGuaranteedParameterOverhead 13943 13830 -0.8% 1.01x (?)
COWTree 11752 11831 +0.7% 0.99x (?)
CSVParsing 2902123 2906246 +0.1% 1.00x (?)
CSVParsingAlt 1437543 1425690 -0.8% 1.01x (?)
CSVParsingAltIndices 2363632 2333181 -1.3% 1.01x (?)
CStringLongAscii 4343 4291 -1.2% 1.01x (?)
CStringLongNonAscii 2553 2545 -0.3% 1.00x (?)
CStringShortAscii 6071 6040 -0.5% 1.01x (?)
Calculator 979 979 +0.0% 1.00x
CaptureProp 285980 285774 -0.1% 1.00x (?)
ChainedFilterMap 227571 227877 +0.1% 1.00x (?)
CharIndexing_ascii_unicodeScalars 315725 319622 +1.2% 0.99x (?)
CharIndexing_ascii_unicodeScalars_Backwards 355347 356163 +0.2% 1.00x (?)
CharIndexing_chinese_unicodeScalars 239390 245828 +2.7% 0.97x (?)
CharIndexing_chinese_unicodeScalars_Backwards 271873 268013 -1.4% 1.01x (?)
CharIndexing_japanese_unicodeScalars_Backwards 426345 425314 -0.2% 1.00x (?)
CharIndexing_korean_unicodeScalars 314918 305533 -3.0% 1.03x (?)
CharIndexing_korean_unicodeScalars_Backwards 345986 348276 +0.7% 0.99x (?)
CharIndexing_punctuatedJapanese_unicodeScalars 56128 56030 -0.2% 1.00x (?)
CharIndexing_punctuatedJapanese_unicodeScalars_Backwards 63441 62877 -0.9% 1.01x (?)
CharIndexing_punctuated_unicodeScalars 70768 70709 -0.1% 1.00x (?)
CharIndexing_punctuated_unicodeScalars_Backwards 80027 80227 +0.2% 1.00x (?)
CharIndexing_russian_unicodeScalars 262767 262299 -0.2% 1.00x (?)
CharIndexing_russian_unicodeScalars_Backwards 296863 297543 +0.2% 1.00x (?)
CharIndexing_tweet_unicodeScalars 626918 626386 -0.1% 1.00x (?)
CharIndexing_tweet_unicodeScalars_Backwards 714989 715417 +0.1% 1.00x (?)
CharIndexing_utf16_unicodeScalars 277268 278461 +0.4% 1.00x (?)
CharIndexing_utf16_unicodeScalars_Backwards 304841 307470 +0.9% 0.99x (?)
CharIteration_ascii_unicodeScalars 146606 147359 +0.5% 0.99x (?)
CharIteration_ascii_unicodeScalars_Backwards 252731 252520 -0.1% 1.00x (?)
CharIteration_chinese_unicodeScalars 111637 111683 +0.0% 1.00x (?)
CharIteration_chinese_unicodeScalars_Backwards 190911 192095 +0.6% 0.99x (?)
CharIteration_japanese_unicodeScalars 176819 176384 -0.2% 1.00x (?)
CharIteration_japanese_unicodeScalars_Backwards 303481 303227 -0.1% 1.00x (?)
CharIteration_korean_unicodeScalars 142367 142828 +0.3% 1.00x (?)
CharIteration_korean_unicodeScalars_Backwards 246810 248505 +0.7% 0.99x (?)
CharIteration_punctuatedJapanese_unicodeScalars 26295 26142 -0.6% 1.01x (?)
CharIteration_punctuatedJapanese_unicodeScalars_Backwards 44371 44134 -0.5% 1.01x (?)
CharIteration_punctuated_unicodeScalars 33166 33330 +0.5% 1.00x (?)
CharIteration_punctuated_unicodeScalars_Backwards 56494 56024 -0.8% 1.01x (?)
CharIteration_russian_unicodeScalars 122153 122278 +0.1% 1.00x (?)
CharIteration_russian_unicodeScalars_Backwards 210398 211166 +0.4% 1.00x (?)
CharIteration_tweet_unicodeScalars 290869 291252 +0.1% 1.00x (?)
CharIteration_tweet_unicodeScalars_Backwards 501375 500080 -0.3% 1.00x (?)
CharIteration_utf16_unicodeScalars 124842 124916 +0.1% 1.00x (?)
CharIteration_utf16_unicodeScalars_Backwards 218291 220832 +1.2% 0.99x (?)
CharacterLiteralsLarge 5786 5746 -0.7% 1.01x (?)
CharacterLiteralsSmall 678 679 +0.1% 1.00x (?)
CharacterPropertiesFetch 5543 5593 +0.9% 0.99x (?)
CharacterPropertiesPrecomputed 3492 3422 -2.0% 1.02x (?)
CharacterPropertiesStashed 2511 2394 -4.7% 1.05x (?)
CharacterPropertiesStashedMemo 4519 4524 +0.1% 1.00x (?)
Chars 34728 34701 -0.1% 1.00x (?)
ClassArrayGetter 964 965 +0.1% 1.00x (?)
Combos 2244 2340 +4.3% 0.96x (?)
DataAccessBytes 2293 2342 +2.1% 0.98x (?)
DataAppendArray 5369 5279 -1.7% 1.02x (?)
DataAppendBytes 5002 4947 -1.1% 1.01x (?)
DataAppendDataLargeToLarge 67920 66559 -2.0% 1.02x (?)
DataAppendDataLargeToMedium 35985 35367 -1.7% 1.02x (?)
DataAppendDataLargeToSmall 34332 34785 +1.3% 0.99x (?)
DataAppendDataMediumToLarge 38557 37552 -2.6% 1.03x (?)
DataAppendDataMediumToMedium 6465 6524 +0.9% 0.99x (?)
DataAppendDataMediumToSmall 5917 5979 +1.0% 0.99x (?)
DataAppendDataSmallToLarge 37480 36628 -2.3% 1.02x (?)
DataAppendDataSmallToMedium 6081 6103 +0.4% 1.00x (?)
DataAppendDataSmallToSmall 5761 5928 +2.9% 0.97x (?)
DataAppendSequence 1935067 1936086 +0.1% 1.00x (?)
DataCount 223 223 +0.0% 1.00x
DataMutateBytes 5237 5201 -0.7% 1.01x (?)
DataReplaceLarge 37475 37418 -0.2% 1.00x (?)
DataReplaceLargeBuffer 58475 57732 -1.3% 1.01x (?)
DataReplaceMedium 8209 7861 -4.2% 1.04x (?)
DataReplaceSmall 5755 5804 +0.9% 0.99x (?)
DataReplaceSmallBuffer 9139 9082 -0.6% 1.01x (?)
DataReset 2900 2892 -0.3% 1.00x (?)
DataSetCount 567 569 +0.4% 1.00x (?)
DataSubscript 444 443 -0.2% 1.00x (?)
DictOfArraysToArrayOfDicts 3506 3497 -0.3% 1.00x (?)
Dictionary 2133 2139 +0.3% 1.00x (?)
Dictionary2 1288 1284 -0.3% 1.00x (?)
Dictionary2OfObjects 4173 4244 +1.7% 0.98x (?)
Dictionary3 826 826 +0.0% 1.00x
Dictionary3OfObjects 2119 2151 +1.5% 0.99x (?)
Dictionary4 1196 1196 +0.0% 1.00x
Dictionary4Legacy 1492 1491 -0.1% 1.00x (?)
Dictionary4OfObjects 1772 1766 -0.3% 1.00x (?)
Dictionary4OfObjectsLegacy 2101 2104 +0.1% 1.00x (?)
DictionaryBridge 1264 1277 +1.0% 0.99x (?)
DictionaryCopy 308939 309549 +0.2% 1.00x (?)
DictionaryFilter 327567 328079 +0.2% 1.00x (?)
DictionaryGroup 4380 4386 +0.1% 1.00x (?)
DictionaryGroupOfObjects 6950 6918 -0.5% 1.00x (?)
DictionaryKeysContainsCocoa 63 66 +4.8% 0.95x (?)
DictionaryLiteral 8577 8663 +1.0% 0.99x (?)
DictionaryOfObjects 5861 5707 -2.6% 1.03x (?)
DictionaryRemove 16944 16956 +0.1% 1.00x (?)
DictionaryRemoveOfObjects 52723 52352 -0.7% 1.01x (?)
DictionarySubscriptDefaultMutation 1964 1977 +0.7% 0.99x (?)
DictionarySubscriptDefaultMutationArray 2234 2231 -0.1% 1.00x (?)
DictionarySubscriptDefaultMutationArrayOfObjects 9210 9209 -0.0% 1.00x (?)
DictionarySubscriptDefaultMutationOfObjects 5262 5331 +1.3% 0.99x (?)
DictionarySwap 4863 4857 -0.1% 1.00x (?)
DictionarySwapAt 32959 32786 -0.5% 1.01x (?)
DictionarySwapAtOfObjects 112709 113555 +0.8% 0.99x (?)
DictionarySwapOfObjects 19226 19481 +1.3% 0.99x (?)
DoubleWidthDivision 0 0 +0.0% 1.00x
DropFirstAnyCollection 15538 15529 -0.1% 1.00x (?)
DropFirstAnyCollectionLazy 113991 114447 +0.4% 1.00x (?)
DropFirstAnySeqCRangeIter 24117 24096 -0.1% 1.00x (?)
DropFirstAnySeqCRangeIterLazy 24105 24113 +0.0% 1.00x (?)
DropFirstAnySeqCntRange 15537 15512 -0.2% 1.00x (?)
DropFirstAnySeqCntRangeLazy 15568 15582 +0.1% 1.00x (?)
DropFirstAnySequence 13099 13050 -0.4% 1.00x (?)
DropFirstAnySequenceLazy 12819 12838 +0.1% 1.00x (?)
DropFirstArray 3390 3390 +0.0% 1.00x
DropFirstArrayLazy 29468 29452 -0.1% 1.00x (?)
DropFirstCountableRange 345 346 +0.3% 1.00x
DropFirstCountableRangeLazy 34728 34755 +0.1% 1.00x (?)
DropFirstSequence 12620 12617 -0.0% 1.00x (?)
DropFirstSequenceLazy 12460 12462 +0.0% 1.00x (?)
DropLastAnyCollection 5187 5177 -0.2% 1.00x (?)
DropLastAnyCollectionLazy 38768 38585 -0.5% 1.00x (?)
DropLastAnySeqCRangeIter 39444 39407 -0.1% 1.00x (?)
DropLastAnySeqCRangeIterLazy 39333 39259 -0.2% 1.00x (?)
DropLastAnySeqCntRange 5188 5194 +0.1% 1.00x (?)
DropLastAnySeqCntRangeLazy 5208 5206 -0.0% 1.00x (?)
DropLastAnySequence 29244 29224 -0.1% 1.00x (?)
DropLastAnySequenceLazy 29312 29307 -0.0% 1.00x (?)
DropLastCountableRange 119 119 +0.0% 1.00x
DropLastCountableRangeLazy 11610 11605 -0.0% 1.00x (?)
DropLastSequence 28919 29004 +0.3% 1.00x (?)
DropLastSequenceLazy 29325 29322 -0.0% 1.00x (?)
DropWhileAnyCollection 20141 20132 -0.0% 1.00x (?)
DropWhileAnyCollectionLazy 22646 22591 -0.2% 1.00x (?)
DropWhileAnySeqCRangeIter 24669 24639 -0.1% 1.00x (?)
DropWhileAnySeqCRangeIterLazy 22400 22417 +0.1% 1.00x (?)
DropWhileAnySeqCntRange 20161 20101 -0.3% 1.00x (?)
DropWhileAnySeqCntRangeLazy 22468 22422 -0.2% 1.00x (?)
DropWhileAnySequence 13610 13632 +0.2% 1.00x (?)
DropWhileAnySequenceLazy 12344 12353 +0.1% 1.00x (?)
DropWhileArrayLazy 13633 13636 +0.0% 1.00x (?)
DropWhileCountableRange 4937 4928 -0.2% 1.00x (?)
DropWhileCountableRangeLazy 22111 22136 +0.1% 1.00x (?)
DropWhileSequence 13243 13222 -0.2% 1.00x (?)
DropWhileSequenceLazy 12068 12058 -0.1% 1.00x (?)
EqualStringSubstring 72 72 +0.0% 1.00x
EqualSubstringString 72 72 +0.0% 1.00x
EqualSubstringSubstring 72 72 +0.0% 1.00x
EqualSubstringSubstringGenericEquatable 59 59 +0.0% 1.00x
ErrorHandling 5624 5481 -2.5% 1.03x (?)
ExclusivityGlobal 183 183 +0.0% 1.00x
ExclusivityIndependent 72 72 +0.0% 1.00x
FatCompactMap 286183 286290 +0.0% 1.00x (?)
FilterEvenUsingReduce 3558 3574 +0.4% 1.00x (?)
FilterEvenUsingReduceInto 1831 1832 +0.1% 1.00x (?)
FloatingPointPrinting_Double_description_small 22268 22341 +0.3% 1.00x (?)
FloatingPointPrinting_Double_description_uniform 33914 33934 +0.1% 1.00x (?)
FloatingPointPrinting_Float80_description_small 29303 29330 +0.1% 1.00x (?)
FloatingPointPrinting_Float80_description_uniform 59875 59743 -0.2% 1.00x (?)
FloatingPointPrinting_Float80_interpolated 119172 115087 -3.4% 1.04x (?)
FloatingPointPrinting_Float_description_small 6368 6364 -0.1% 1.00x (?)
FloatingPointPrinting_Float_description_uniform 17232 17216 -0.1% 1.00x (?)
FloatingPointPrinting_Float_interpolated 69078 69631 +0.8% 0.99x (?)
FrequenciesUsingReduce 10632 10909 +2.6% 0.97x (?)
FrequenciesUsingReduceInto 3091 3162 +2.3% 0.98x (?)
Hanoi 19157 19158 +0.0% 1.00x (?)
HashTest 20785 20895 +0.5% 0.99x (?)
Histogram 6283 6286 +0.0% 1.00x (?)
Integrate 585 586 +0.2% 1.00x (?)
IterateData 5046 5038 -0.2% 1.00x (?)
Join 195 195 +0.0% 1.00x
LazilyFilteredArrayContains 731915 731219 -0.1% 1.00x (?)
LazilyFilteredArrays 1402743 1405156 +0.2% 1.00x (?)
LazilyFilteredRange 539303 539034 -0.0% 1.00x (?)
LessSubstringSubstring 72 72 +0.0% 1.00x
LessSubstringSubstringGenericComparable 56 56 +0.0% 1.00x
LinkedList 32636 32609 -0.1% 1.00x (?)
LuhnAlgoEager 5455 5590 +2.5% 0.98x (?)
LuhnAlgoLazy 5662 5767 +1.9% 0.98x (?)
MapReduce 25000 25122 +0.5% 1.00x (?)
MapReduceAnyCollection 24997 25057 +0.2% 1.00x (?)
MapReduceAnyCollectionShort 35339 35473 +0.4% 1.00x (?)
MapReduceClass 28854 28886 +0.1% 1.00x (?)
MapReduceClassShort 38809 38790 -0.0% 1.00x (?)
MapReduceLazyCollection 22067 22080 +0.1% 1.00x (?)
MapReduceLazyCollectionShort 33006 32861 -0.4% 1.00x (?)
MapReduceLazySequence 20624 20595 -0.1% 1.00x (?)
MapReduceSequence 30064 30031 -0.1% 1.00x (?)
MapReduceShort 36377 36633 +0.7% 0.99x (?)
MapReduceShortString 214 211 -1.4% 1.01x (?)
MapReduceString 1697 1696 -0.1% 1.00x (?)
Memset 44805 44788 -0.0% 1.00x (?)
MonteCarloE 1141440 1141433 -0.0% 1.00x (?)
MonteCarloPi 5206609 5208861 +0.0% 1.00x (?)
NSDictionaryCastToSwift 8133 7821 -3.8% 1.04x (?)
NSError 596 599 +0.5% 0.99x (?)
NSStringConversion 787 788 +0.1% 1.00x (?)
NibbleSort 516775 516749 -0.0% 1.00x (?)
NopDeinit 190644 190903 +0.1% 1.00x (?)
ObjectAllocation 1242 1260 +1.4% 0.99x (?)
ObjectiveCBridgeFromNSArrayAnyObject 28052 28008 -0.2% 1.00x (?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 9139 8818 -3.5% 1.04x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 47482 46447 -2.2% 1.02x (?)
ObjectiveCBridgeFromNSDictionaryAnyObject 116896 113332 -3.0% 1.03x (?)
ObjectiveCBridgeFromNSSetAnyObjectForced 5743 5595 -2.6% 1.03x (?)
ObjectiveCBridgeFromNSSetAnyObjectToString 73418 75850 +3.3% 0.97x (?)
ObjectiveCBridgeFromNSString 2885 2875 -0.3% 1.00x (?)
ObjectiveCBridgeFromNSStringForced 2804 2812 +0.3% 1.00x (?)
ObjectiveCBridgeStubDataAppend 6703 6646 -0.9% 1.01x (?)
ObjectiveCBridgeStubDateMutation 774 776 +0.3% 1.00x (?)
ObjectiveCBridgeStubFromNSDate 6902 6910 +0.1% 1.00x (?)
ObjectiveCBridgeStubFromNSString 1079 1078 -0.1% 1.00x (?)
ObjectiveCBridgeStubFromNSStringRef 205 205 +0.0% 1.00x
ObjectiveCBridgeStubNSDataAppend 3091 3089 -0.1% 1.00x (?)
ObjectiveCBridgeStubNSDateMutationRef 15813 16230 +2.6% 0.97x (?)
ObjectiveCBridgeStubToArrayOfNSString 40551 40632 +0.2% 1.00x (?)
ObjectiveCBridgeStubToNSDate 15185 15864 +4.5% 0.96x (?)
ObjectiveCBridgeStubToNSDateRef 3490 3467 -0.7% 1.01x (?)
ObjectiveCBridgeStubToNSString 2432 2427 -0.2% 1.00x (?)
ObjectiveCBridgeStubToNSStringRef 153 153 +0.0% 1.00x
ObjectiveCBridgeStubURLAppendPath 286676 288793 +0.7% 0.99x (?)
ObjectiveCBridgeStubURLAppendPathRef 298031 294220 -1.3% 1.01x (?)
ObjectiveCBridgeToNSArray 15485 15078 -2.6% 1.03x (?)
ObjectiveCBridgeToNSDictionary 29535 29016 -1.8% 1.02x (?)
ObjectiveCBridgeToNSSet 18595 18487 -0.6% 1.01x (?)
ObjectiveCBridgeToNSString 541 542 +0.2% 1.00x (?)
ObserverClosure 6352 6341 -0.2% 1.00x (?)
ObserverForwarderStruct 4190 4193 +0.1% 1.00x (?)
ObserverPartiallyAppliedMethod 7882 7891 +0.1% 1.00x (?)
ObserverUnappliedMethod 7829 7828 -0.0% 1.00x (?)
OpaqueConsumingUsers 13415 13407 -0.1% 1.00x (?)
OpenClose 531 531 +0.0% 1.00x
PartialApplyDynamicType 39252 39271 +0.0% 1.00x (?)
Phonebook 15025 15064 +0.3% 1.00x (?)
PointerArithmetics 131667 131805 +0.1% 1.00x (?)
PolymorphicCalls 2435 2455 +0.8% 0.99x (?)
PopFrontArray 4627 4622 -0.1% 1.00x (?)
PopFrontArrayGeneric 5153 5158 +0.1% 1.00x (?)
PopFrontUnsafePointer 11111 10734 -3.4% 1.04x (?)
PrefixAnyCollection 15498 15532 +0.2% 1.00x (?)
PrefixAnyCollectionLazy 112434 113128 +0.6% 0.99x (?)
PrefixAnySeqCRangeIter 19279 19240 -0.2% 1.00x (?)
PrefixAnySeqCRangeIterLazy 19182 19189 +0.0% 1.00x (?)
PrefixAnySeqCntRange 15517 15528 +0.1% 1.00x (?)
PrefixAnySeqCntRangeLazy 15577 15553 -0.2% 1.00x (?)
PrefixAnySequence 10575 10565 -0.1% 1.00x (?)
PrefixAnySequenceLazy 10508 10522 +0.1% 1.00x (?)
PrefixArray 3359 3361 +0.1% 1.00x (?)
PrefixArrayLazy 29436 29487 +0.2% 1.00x (?)
PrefixCountableRange 345 346 +0.3% 1.00x
PrefixCountableRangeLazy 34708 34758 +0.1% 1.00x (?)
PrefixSequence 10221 10217 -0.0% 1.00x (?)
PrefixSequenceLazy 10128 10145 +0.2% 1.00x (?)
PrefixWhileAnyCollection 29126 29124 -0.0% 1.00x (?)
PrefixWhileAnyCollectionLazy 18774 18693 -0.4% 1.00x (?)
PrefixWhileAnySeqCRangeIter 33654 33564 -0.3% 1.00x
PrefixWhileAnySeqCRangeIterLazy 18640 18563 -0.4% 1.00x (?)
PrefixWhileAnySeqCntRange 29136 29150 +0.0% 1.00x (?)
PrefixWhileAnySeqCntRangeLazy 18556 18623 +0.4% 1.00x (?)
PrefixWhileAnySequence 25652 25633 -0.1% 1.00x (?)
PrefixWhileAnySequenceLazy 11064 11057 -0.1% 1.00x (?)
PrefixWhileArray 10158 10172 +0.1% 1.00x (?)
PrefixWhileArrayLazy 12024 12016 -0.1% 1.00x (?)
PrefixWhileCountableRange 13966 13958 -0.1% 1.00x (?)
PrefixWhileCountableRangeLazy 18402 18314 -0.5% 1.00x (?)
PrefixWhileSequence 25288 25294 +0.0% 1.00x (?)
PrefixWhileSequenceLazy 10844 10839 -0.0% 1.00x (?)
Prims 9317 9269 -0.5% 1.01x (?)
PrimsSplit 9461 9401 -0.6% 1.01x (?)
QueueConcrete 13810 13771 -0.3% 1.00x (?)
QueueGeneric 18364 18406 +0.2% 1.00x (?)
RC4 16174 16217 +0.3% 1.00x (?)
RGBHistogram 23131 23092 -0.2% 1.00x (?)
RGBHistogramOfObjects 83375 83825 +0.5% 0.99x (?)
Radix2CooleyTukey 41955 41966 +0.0% 1.00x (?)
Radix2CooleyTukeyf 35785 36267 +1.3% 0.99x (?)
RandomDoubleDef 89049 90236 +1.3% 0.99x (?)
RandomDoubleLCG 59413 59382 -0.1% 1.00x (?)
RandomIntegersDef 44548 44576 +0.1% 1.00x (?)
RandomIntegersLCG 35152 35104 -0.1% 1.00x (?)
RandomShuffleDef 2173903 2174179 +0.0% 1.00x (?)
RandomShuffleLCG 1505220 1509256 +0.3% 1.00x (?)
RangeAssignment 2685 2683 -0.1% 1.00x (?)
RangeIterationSigned 14603 14594 -0.1% 1.00x (?)
RangeReplaceableCollectionPlusDefault 10847 11021 +1.6% 0.98x (?)
RecursiveOwnedParameter 6136 6096 -0.7% 1.01x
RemoveWhereFilterInts 2056 2054 -0.1% 1.00x (?)
RemoveWhereFilterString 1317 1320 +0.2% 1.00x (?)
RemoveWhereFilterStrings 2578 2580 +0.1% 1.00x (?)
RemoveWhereMoveInts 3339 3341 +0.1% 1.00x (?)
RemoveWhereMoveStrings 3882 3880 -0.1% 1.00x (?)
RemoveWhereQuadraticInts 8424 8463 +0.5% 1.00x (?)
RemoveWhereQuadraticString 2563 2559 -0.2% 1.00x (?)
RemoveWhereQuadraticStrings 10066 10059 -0.1% 1.00x (?)
RemoveWhereSwapInts 6011 6011 +0.0% 1.00x
RemoveWhereSwapStrings 6942 6944 +0.0% 1.00x (?)
ReversedArray 12906 12904 -0.0% 1.00x (?)
ReversedBidirectional 50973 51239 +0.5% 0.99x (?)
ReversedDictionary 23435 23416 -0.1% 1.00x (?)
RomanNumbers 1325274 1316535 -0.7% 1.01x (?)
SequenceAlgosAnySequence 13128 13127 -0.0% 1.00x (?)
SequenceAlgosArray 727107 727569 +0.1% 1.00x (?)
SequenceAlgosContiguousArray 290169 290152 -0.0% 1.00x (?)
SequenceAlgosList 8685 8682 -0.0% 1.00x (?)
SequenceAlgosRange 1289636 1289896 +0.0% 1.00x (?)
SequenceAlgosUnfoldSequence 6456 6452 -0.1% 1.00x (?)
SetExclusiveOr 16515 16496 -0.1% 1.00x (?)
SetExclusiveOr_OfObjects 41951 42010 +0.1% 1.00x (?)
SetIntersect 6933 6938 +0.1% 1.00x (?)
SetIntersect_OfObjects 10648 10597 -0.5% 1.00x (?)
SetIsSubsetOf 1213 1200 -1.1% 1.01x (?)
SetIsSubsetOf_OfObjects 2269 2255 -0.6% 1.01x (?)
SetUnion 11985 11978 -0.1% 1.00x (?)
SetUnion_OfObjects 30191 30194 +0.0% 1.00x (?)
SevenBoom 1020 1019 -0.1% 1.00x (?)
Sim2DArray 43675 43606 -0.2% 1.00x (?)
SortLargeExistentials 9695 9700 +0.1% 1.00x (?)
SortLettersInPlace 1564 1556 -0.5% 1.01x (?)
SortSortedStrings 880 878 -0.2% 1.00x (?)
SortStrings 1828 1829 +0.1% 1.00x (?)
SortStringsUnicode 2728 2725 -0.1% 1.00x (?)
StackPromo 94052 94874 +0.9% 0.99x (?)
StaticArray 2589 2603 +0.5% 0.99x (?)
StrComplexWalk 7269 7271 +0.0% 1.00x (?)
StrToInt 83924 83811 -0.1% 1.00x (?)
StringAdder 766 765 -0.1% 1.00x (?)
StringBuilder 5140 5158 +0.4% 1.00x (?)
StringBuilderSmallReservingCapacity 5169 5158 -0.2% 1.00x (?)
StringBuilderWithLongSubstring 3266 3412 +4.5% 0.96x (?)
StringComparison_abnormal 1352 1348 -0.3% 1.00x (?)
StringComparison_ascii 8753 8754 +0.0% 1.00x (?)
StringComparison_emoji 1980 1983 +0.2% 1.00x (?)
StringComparison_fastPrenormal 4814 4813 -0.0% 1.00x (?)
StringComparison_latin1 3740 3735 -0.1% 1.00x (?)
StringComparison_longSharedPrefix 2335 2332 -0.1% 1.00x (?)
StringComparison_nonBMPSlowestPrenormal 3653 3652 -0.0% 1.00x (?)
StringComparison_slowerPrenormal 4106 4099 -0.2% 1.00x (?)
StringComparison_zalgo 123104 123509 +0.3% 1.00x (?)
StringEdits 375713 375680 -0.0% 1.00x (?)
StringEnumRawValueInitialization 21323 21422 +0.5% 1.00x (?)
StringEqualPointerComparison 1775 1775 +0.0% 1.00x
StringFromLongWholeSubstring 22 22 +0.0% 1.00x
StringFromLongWholeSubstringGeneric 194 195 +0.5% 0.99x (?)
StringHasPrefixAscii 3293 3296 +0.1% 1.00x (?)
StringHasPrefixUnicode 119388 120282 +0.7% 0.99x (?)
StringHasSuffixAscii 3375 3377 +0.1% 1.00x (?)
StringHasSuffixUnicode 114342 114175 -0.1% 1.00x (?)
StringInterpolation 12344 12250 -0.8% 1.01x (?)
StringInterpolationManySmallSegments 18933 18996 +0.3% 1.00x (?)
StringInterpolationSmall 6627 6656 +0.4% 1.00x (?)
StringMatch 39497 40497 +2.5% 0.98x (?)
StringRemoveDupes 728 728 +0.0% 1.00x
StringUTF16Builder 7985 8008 +0.3% 1.00x (?)
StringUTF16SubstringBuilder 22713 22306 -1.8% 1.02x (?)
StringWalk 12393 12386 -0.1% 1.00x (?)
StringWithCString 43798 43821 +0.1% 1.00x (?)
StringWordBuilder 2421 2425 +0.2% 1.00x (?)
StringWordBuilderReservingCapacity 1970 1964 -0.3% 1.00x (?)
SubstringComparable 1578 1577 -0.1% 1.00x (?)
SubstringEqualString 1714 1702 -0.7% 1.01x (?)
SubstringEquatable 5312 5323 +0.2% 1.00x (?)
SubstringFromLongString 15 15 +0.0% 1.00x
SubstringFromLongStringGeneric 103 103 +0.0% 1.00x
SuffixAnyCollection 5200 5194 -0.1% 1.00x (?)
SuffixAnyCollectionLazy 38761 38068 -1.8% 1.02x (?)
SuffixAnySeqCRangeIter 35580 35588 +0.0% 1.00x (?)
SuffixAnySeqCRangeIterLazy 35547 35533 -0.0% 1.00x (?)
SuffixAnySeqCntRange 5183 5198 +0.3% 1.00x (?)
SuffixAnySeqCntRangeLazy 5212 5208 -0.1% 1.00x (?)
SuffixAnySequence 25183 25199 +0.1% 1.00x (?)
SuffixAnySequenceLazy 25179 25160 -0.1% 1.00x (?)
SuffixCountableRange 119 119 +0.0% 1.00x
SuffixCountableRangeLazy 11615 11608 -0.1% 1.00x (?)
SuffixSequence 25111 25083 -0.1% 1.00x (?)
SuffixSequenceLazy 25141 25113 -0.1% 1.00x (?)
SumUsingReduce 155355 155283 -0.0% 1.00x (?)
SumUsingReduceInto 148692 148770 +0.1% 1.00x (?)
SuperChars 88923 89242 +0.4% 1.00x (?)
TwoSum 3438 3440 +0.1% 1.00x (?)
UTF8Decode 28692 28725 +0.1% 1.00x (?)
UTF8Decode_InitDecoding 1401 1404 +0.2% 1.00x (?)
UTF8Decode_InitDecoding_ascii 868 874 +0.7% 0.99x (?)
UTF8Decode_InitFromBytes 1179 1195 +1.4% 0.99x (?)
UTF8Decode_InitFromBytes_ascii 576 578 +0.3% 1.00x (?)
UTF8Decode_InitFromData 1242 1266 +1.9% 0.98x (?)
Walsh 12147 12151 +0.0% 1.00x (?)
WordCountHistogramASCII 36898 36933 +0.1% 1.00x (?)
WordCountHistogramUTF16 45121 45009 -0.2% 1.00x (?)
WordCountUniqueASCII 6938 6955 +0.2% 1.00x (?)
WordCountUniqueUTF16 12454 12352 -0.8% 1.01x (?)
WordSplitASCII 12520 12606 +0.7% 0.99x (?)
WordSplitUTF16 14033 14286 +1.8% 0.98x (?)
XorLoop 23362 23360 -0.0% 1.00x (?)
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

@atrick
Copy link
Contributor Author

atrick commented Jun 19, 2018

The -Onone benchmark regressions and improvements are all spurious. None of this code is touched at -Onone.

@rajbarik
Copy link
Contributor

rajbarik commented Jun 19, 2018 via email

@atrick
Copy link
Contributor Author

atrick commented Jun 20, 2018

@rajbarik or @slavapestov It would be good to get a review on this, not just to unblock @rajbarik, but also to get bug fixes on 4.2 sooner. If you don't have time let me know so I can recruit someone for the review.

@atrick
Copy link
Contributor Author

atrick commented Jun 22, 2018

@swift-ci test.

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 73b071f0cfb8acb3f6d76ad3f03d705e92309acf

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 73b071f0cfb8acb3f6d76ad3f03d705e92309acf

Fixes <rdar://40555427> [SR-7773]:
SILCombiner::propagateConcreteTypeOfInitExistential fails to full propagate type
substitutions.

Fixes <rdar://problem/40923849>
SILCombiner::propagateConcreteTypeOfInitExistential crashes on protocol
compositions.

This rewrite fixes several fundamental bugs in the SILCombiner optimization that
propagates concrete types. In particular, the pass needs to handle:

- Arguments of callee Self type in non-self position.
- Indirect and direct return values of Self type.
- Types that indirectly depend on Self within callee function signature.
- Protocol composition existentials.
- All of the above need to work for protocol extensions as well as witness methods.
- For protocol extensions, conformance lookup should be based on the existential's conformance list.

Additionally, the optimization should not depend on a SILFunction's DeclContext,
which is not serialized. (In fact, we should prevent SIL passes from using
DeclContext). Furthermore, the code needs to be expressed in a way that one can
reason about correctness and invariants.

The root cause of these bugs is that SIL passes are written based on untested
assumptions of Swift type system. A SIL pass needs to handle all verifiable SIL
input because passes need to be composable. Bail-out logic can be added to
simplify the design; however, _the bail-out logic itself cannot make any
assumptions about the language or type system_ that aren't clearly and
explicitly enforced in the SIL verifier. This is a common mistake and major
source of bugs.

I created as many unit tests as I reasonably could to prevent this code from
regressing. Creating enough unit tests to cover all corner cases that were
broken in the original code would be intractable. But the code has been
simplified such that many corner cases disappear.

This opens up some oportunity for generalizing the optimization and eliminating
special cases. However, I want this PR to be limited to fixing correctness
issues only. In the long term, it would be preferable to replace this
optimization entirely with a much more powerful general type propagation pass.
SILInstruction *
SILCombiner::createApplyWithConcreteType(FullApplySite Apply,
const ConcreteExistentialInfo &CEI,
SILBuilderContext &BuilderCtx) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@atrick Does this handle non-self arguments? One part of my optimizations was to add this functionality #13991.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm limiting this PR to fixing correctness and trying hard to generalize the code without generalizing the current behavior.

The code in this function subsumes what used to be in multiple propagateConcreteTypeOfInitExistential functions (for both witness and protocol extension functions).

Relative to your PR #13991, it is one level above your simple createApplyWithConcreteType and could probably be reused by your propagateConcreteTypeOfInitExistentialToAllApplyArgs by generalizing the behavior. I think these PRs are mostly complementary and merging them later will be an additional code quality improvement.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

// Create a set of arguments.
SmallVector<SILValue, 8> NewArgs;
for (auto Arg : Apply.getArgumentsWithoutSelf()) {
NewArgs.push_back(Arg);
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like only self arguments are optimized.


return NewAI;
return NewApply.getInstruction();
Copy link
Contributor

Choose a reason for hiding this comment

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

At some point, we should merge what is there in PR #13991 to handle both self and non-self concrete type propagation. The concrete type can be obtained using a number of techniques including protocolconformance analysis, global_addr pattern match and init_existential pattern match. Makes sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it should be fully generalized. I just need to separate out the bug fix which can hopefully be merged onto a release branch.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good.

@atrick
Copy link
Contributor Author

atrick commented Jun 26, 2018

@slavapestov do you have time to review this for 4.2?

Copy link
Contributor

@slavapestov slavapestov left a comment

Choose a reason for hiding this comment

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

Thanks!

@atrick
Copy link
Contributor Author

atrick commented Jun 26, 2018

@swift-ci test.

@atrick
Copy link
Contributor Author

atrick commented Jun 26, 2018

@swift-ci test source compatibility.

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 3534593b47ce43981c68aa2921cac8e3dd32fac8

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 3534593b47ce43981c68aa2921cac8e3dd32fac8

@atrick
Copy link
Contributor Author

atrick commented Jun 27, 2018

SCK fails on master:
FAIL_CoreStore_3.2_BuildXcodeWorkspaceScheme_CoreStoreDemo_generic-platform-iOS.log
Assertion failed: ((HadError || !M.is<SourceFile*>() || M.get<SourceFile*>()->ASTStage < SourceFile::TypeChecked) && "UnresolvedDot" "in wrong phase"), function walkToExprPre, file swift/include/swift/AST/ExprNodes.def, line 101.

@atrick atrick merged commit 9d4b4c7 into swiftlang:master Jun 27, 2018
atrick added a commit that referenced this pull request Jun 27, 2018
* Reorganizing the code to find init_existential; Move them to Existential.cpp/h in order for other passes such as ExistentialSpecializer to use it apart from SILCombiner

* [NFC] Add SILBuilderContext.

In an upcoming bug fix, I want to pass SILBuilderContext to a
utility. I could continue reusing SILBuilder, even though the utility
must set its own insertion point and debug location. However, this is
terrible practice that I don't want to perpetuate.

The lifetime of a SILBuilder should correspond to a single insertion
point and debug location. That's the only sane way to preserve debug
information in SIL passes.

There are various pieces of contextual state that we've been adding to
the SILBuilder. Those have made it impossible to use SILBuilder
correctly. I'm pulling the context out, so clients can begin using
better practices. In the future, we can make SILBuilderContext
polymorphic, so passes can extend it easily with arbitrary
callbacks. We can also make it self-contained so we don't need to pass
around pointers to an InsertedInst list anymore.

(cherry picked from commit df94dff)

* Rewrite SILCombiner::propagateConcreteTypeOfInitExistential. (#17315)

Fixes <rdar://40555427> [SR-7773]:
SILCombiner::propagateConcreteTypeOfInitExistential fails to full propagate type
substitutions.

Fixes <rdar://problem/40923849>
SILCombiner::propagateConcreteTypeOfInitExistential crashes on protocol
compositions.

This rewrite fixes several fundamental bugs in the SILCombiner optimization that
propagates concrete types. In particular, the pass needs to handle:

- Arguments of callee Self type in non-self position.
- Indirect and direct return values of Self type.
- Types that indirectly depend on Self within callee function signature.
- Protocol composition existentials.
- All of the above need to work for protocol extensions as well as witness methods.
- For protocol extensions, conformance lookup should be based on the existential's conformance list.

Additionally, the optimization should not depend on a SILFunction's DeclContext,
which is not serialized. (In fact, we should prevent SIL passes from using
DeclContext). Furthermore, the code needs to be expressed in a way that one can
reason about correctness and invariants.

The root cause of these bugs is that SIL passes are written based on untested
assumptions of Swift type system. A SIL pass needs to handle all verifiable SIL
input because passes need to be composable. Bail-out logic can be added to
simplify the design; however, _the bail-out logic itself cannot make any
assumptions about the language or type system_ that aren't clearly and
explicitly enforced in the SIL verifier. This is a common mistake and major
source of bugs.

I created as many unit tests as I reasonably could to prevent this code from
regressing. Creating enough unit tests to cover all corner cases that were
broken in the original code would be intractable. But the code has been
simplified such that many corner cases disappear.

This opens up some oportunity for generalizing the optimization and eliminating
special cases. However, I want this PR to be limited to fixing correctness
issues only. In the long term, it would be preferable to replace this
optimization entirely with a much more powerful general type propagation pass.

(cherry picked from commit 9d4b4c7)

* Merge rewrite SILCombiner::propagateConcreteTypeOfInitExistential onto 4.2.
InitExistential = findInitExistential(openedUse, OpenedArchetype,
OpenedArchetypeDef, isCopied);
if (!InitExistential)
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

@atrick @slavapestov Could you decouple the body from the constructor and invoke it separately via an API? "findInitExistential" is not the only way to determine concrete types. For example, I am using ProtocolConformance Analysis to determine concrete types. I am planning on using the same ConcreteExistentialInfo struct and reuse the createApplyWithConcreteType. Let me know if you are busy and it sounds good to you, I can try to decouple them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rajbarik All suggestions are welcome. I'm not dogmatic about how ConcreteExistentialInfo is constructed or accessed. I like to start with minimal design and develop outward. If you have a rough prototype, and want quick feedback, just point me to a branch or gist.

First thing to consider: do all the members of ConcreteExistentialInfo make sense for all the SIL patterns you're handling. It's fine to have a few optional fields:

  • ConcreteTypeDef is null to when ConcreteType is not an opened archetype
  • You could make InitExistential null to indicate the existential wasn't found.

Anything much beyond that and it may be better to have a discrimiated union or a smaller more general Info composing a larger one.

At any rate, I think it's fine if you optionally pass in a PCA to the ConcreteExistentialInfo construction, or even define a second constructor. If that's awkward for some reason you could move to a free standing or static function to create the Info.

Copy link
Contributor

Choose a reason for hiding this comment

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

@atrick Thanks. I am currently adding a new constructor for CEI with values computed from PCA and this constructor will take a subset of the values currently present in the CEI. We can later think about a more tighter integration. However, one problem I am running into is regarding the following code in method createApplyWithConcreteType:

if (CEI.isCopied && !canReplaceCopiedSelf(Apply, CEI.InitExistential, DA))

When we use PCA, there is no InitExistential and no isCopied. So, the question is, can this check be moved to isValid() function in CEI or prepended with a check on InitExistential not being null? Do you have any recommendation?

Copy link
Contributor

Choose a reason for hiding this comment

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

Please keep in mind that a check on InitExistential being not null, is minimal in terms of code changes :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The safe thing to do is to bail out under the isCopied case if we didn't find the init_existential.
if (isCopied && (!InitExistential || !canReplaceCopiedSelf(Apply, InitExistential)
I'm sure we could do better but if you don't care about that case and never hit it then why deal with it?

@atrick atrick deleted the silcombine-existential-fix branch October 16, 2018 16:27
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.

4 participants