Skip to content
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

SideEffectAnalysis: don't assume that arguments with trivial type can not be pointers. #34289

Merged
merged 1 commit into from
Oct 13, 2020

Conversation

eeckstein
Copy link
Contributor

Even values of trivial type can contain a Builtin.RawPointer, which can be used to read/write from/to.

To compensate for the removed check, enable the escape-analysis check in MemBehavior (as it was before).

This fixes a recently introduced miscompile in #34252.

rdar://problem/70220876

…not be pointers.

Even values of trivial type can contain a Builtin.RawPointer, which can be used to read/write from/to.

To compensate for the removed check, enable the escape-analysis check in MemBehavior (as it was before).

This fixes a recently introduced miscompile.
rdar://problem/70220876
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein
Copy link
Contributor Author

@swift-ci benchmark

@swift-ci
Copy link
Contributor

Performance: -O

Regression OLD NEW DELTA RATIO
ArrayAppendLazyMap 1490 2570 +72.5% 0.58x
RemoveWhereSwapStrings 411 580 +41.1% 0.71x
String.data.Empty 38 47 +23.7% 0.81x (?)
String.data.Small 41 50 +22.0% 0.82x (?)
ArrayAppendRepeatCol 700 810 +15.7% 0.86x (?)
String.data.LargeUnicode 116 133 +14.7% 0.87x (?)
DataMutateBytesSmall 180 200 +11.1% 0.90x
ArrayAppendLatin1Substring 28368 31140 +9.8% 0.91x (?)
ArrayAppendAsciiSubstring 27828 30528 +9.7% 0.91x (?)
ArrayAppendUTF16Substring 27864 30528 +9.6% 0.91x (?)
BucketSort 181 195 +7.7% 0.93x (?)
 
Improvement OLD NEW DELTA RATIO
FlattenListFlatMap 26477 5462 -79.4% 4.85x
SortIntPyramid 1300 645 -50.4% 2.02x
RandomShuffleLCG2 848 480 -43.4% 1.77x
MapReduceString 77 44 -42.9% 1.75x
SortAdjacentIntPyramids 1560 990 -36.5% 1.58x
StringFromLongWholeSubstring 5 4 -20.0% 1.25x
DictionaryKeysContainsCocoa 36 32 -11.1% 1.12x (?)
MapReduceShortString 21 19 -9.5% 1.11x (?)
StringWordBuilderReservingCapacity 2490 2280 -8.4% 1.09x (?)
StringWordBuilder 2540 2340 -7.9% 1.09x (?)
DataSetCountSmall 142 131 -7.7% 1.08x (?)
Array2D 7808 7216 -7.6% 1.08x (?)

Code size: -O

Regression OLD NEW DELTA RATIO
FlattenList.o 3690 3914 +6.1% 0.94x
ChaCha.o 14923 15643 +4.8% 0.95x
BinaryFloatingPointConversionFromBinaryInteger.o 28848 30184 +4.6% 0.96x
Mirror.o 10454 10854 +3.8% 0.96x
RangeOverlaps.o 5846 6038 +3.3% 0.97x
ArrayAppend.o 22407 22967 +2.5% 0.98x
IntegerParsing.o 54301 55453 +2.1% 0.98x
Prefix.o 14824 15080 +1.7% 0.98x
DropFirst.o 16660 16932 +1.6% 0.98x
Suffix.o 20669 20925 +1.2% 0.99x
DropLast.o 20415 20639 +1.1% 0.99x
 
Improvement OLD NEW DELTA RATIO
main.o 62407 57911 -7.2% 1.08x
Prims.o 12827 12243 -4.6% 1.05x
PrimsSplit.o 12879 12295 -4.5% 1.05x
SortIntPyramids.o 9142 8756 -4.2% 1.04x
PopFrontGeneric.o 2628 2548 -3.0% 1.03x
Queue.o 12149 11789 -3.0% 1.03x
RandomShuffle.o 3494 3398 -2.7% 1.03x
ArraySubscript.o 2380 2316 -2.7% 1.03x
ArrayOfGenericRef.o 8366 8158 -2.5% 1.03x
CSVParsing.o 54595 53395 -2.2% 1.02x
PopFront.o 3684 3604 -2.2% 1.02x
Hanoi.o 3126 3062 -2.0% 1.02x
COWTree.o 10804 10604 -1.9% 1.02x
ArrayOfRef.o 8747 8587 -1.8% 1.02x
FindStringNaive.o 8627 8483 -1.7% 1.02x
PrimsNonStrongRef.o 126596 124492 -1.7% 1.02x
Array2D.o 3019 2971 -1.6% 1.02x
ArrayInClass.o 4341 4277 -1.5% 1.01x
ClassArrayGetter.o 3444 3396 -1.4% 1.01x
RomanNumbers.o 5932 5852 -1.3% 1.01x
ArraySetElement.o 1190 1174 -1.3% 1.01x
DictionaryGroup.o 11811 11667 -1.2% 1.01x
SortArrayInClass.o 2696 2664 -1.2% 1.01x
NibbleSort.o 13176 13041 -1.0% 1.01x
RangeAssignment.o 3229 3197 -1.0% 1.01x

Performance: -Osize

Regression OLD NEW DELTA RATIO
FlattenListLoop 1995 2507 +25.7% 0.80x (?)
DropLastAnyCollection 59 71 +20.3% 0.83x
String.data.Small 41 49 +19.5% 0.84x (?)
UTF8Decode_InitFromCustom_noncontiguous_ascii_as_ascii 1186 1417 +19.5% 0.84x (?)
UTF8Decode_InitFromCustom_noncontiguous_ascii 1035 1226 +18.5% 0.84x
String.data.Empty 39 46 +17.9% 0.85x (?)
PrefixWhileAnyCollectionLazy 164 184 +12.2% 0.89x (?)
UTF8Decode_InitFromCustom_noncontiguous 465 521 +12.0% 0.89x
PrefixAnyCollection 164 183 +11.6% 0.90x
DropFirstAnyCollection 164 182 +11.0% 0.90x
DropFirstAnySeqCRangeIterLazy 225 249 +10.7% 0.90x
DropFirstAnySeqCntRangeLazy 225 249 +10.7% 0.90x
DropFirstAnySeqCRangeIter 164 181 +10.4% 0.91x (?)
DropFirstAnySeqCntRange 164 181 +10.4% 0.91x
PrefixAnySeqCRangeIterLazy 176 194 +10.2% 0.91x
PrefixAnySeqCntRangeLazy 176 194 +10.2% 0.91x
SuffixAnyCollection 59 65 +10.2% 0.91x
DataMutateBytesSmall 200 220 +10.0% 0.91x (?)
DropWhileAnyCollection 182 200 +9.9% 0.91x
DropWhileAnyCollectionLazy 252 276 +9.5% 0.91x
DropWhileAnySeqCRangeIterLazy 247 270 +9.3% 0.91x
DropWhileAnySeqCntRangeLazy 247 270 +9.3% 0.91x (?)
FlattenListFlatMap 6032 6580 +9.1% 0.92x (?)
ProtocolDispatch 342 371 +8.5% 0.92x (?)
PrefixWhileAnyCollection 217 235 +8.3% 0.92x
PrefixWhileAnySeqCntRangeLazy 168 181 +7.7% 0.93x (?)
 
Improvement OLD NEW DELTA RATIO
ArrayAppendLazyMap 3110 1260 -59.5% 2.47x
RandomShuffleLCG2 800 448 -44.0% 1.79x
MapReduceString 77 45 -41.6% 1.71x
ChaCha 182 145 -20.3% 1.26x
SortAdjacentIntPyramids 1775 1560 -12.1% 1.14x
SubstringComparable 18 16 -11.1% 1.12x
NSStringConversion.UTF8 1029 932 -9.4% 1.10x (?)
FindString.Loop1.Substring 574 521 -9.2% 1.10x
ArrayInitFromSlice 888 812 -8.6% 1.09x (?)
RemoveWhereFilterString 369 338 -8.4% 1.09x
Walsh 953 875 -8.2% 1.09x (?)
DataSetCountSmall 142 131 -7.7% 1.08x (?)
StringWordBuilderReservingCapacity 2470 2280 -7.7% 1.08x (?)
StringWordBuilder 2510 2330 -7.2% 1.08x (?)
ParseInt.UInt64.Decimal 276 257 -6.9% 1.07x (?)
ArrayPlusEqualThreeElements 2050 1910 -6.8% 1.07x (?)

Code size: -Osize

Regression OLD NEW DELTA RATIO
BinaryFloatingPointConversionFromBinaryInteger.o 27877 29145 +4.5% 0.96x
ChaCha.o 12152 12399 +2.0% 0.98x
DropFirst.o 15608 15891 +1.8% 0.98x
IntegerParsing.o 51254 52180 +1.8% 0.98x
Prefix.o 16004 16287 +1.8% 0.98x
DropLast.o 19419 19687 +1.4% 0.99x
Suffix.o 19738 19988 +1.3% 0.99x
CSVParsing.o 50447 51082 +1.3% 0.99x
 
Improvement OLD NEW DELTA RATIO
Sim2DArray.o 1236 1141 -7.7% 1.08x
Array2D.o 2739 2570 -6.2% 1.07x
Memset.o 1802 1712 -5.0% 1.05x
Mirror.o 9966 9573 -3.9% 1.04x
ArraySubscript.o 2185 2105 -3.7% 1.04x
RandomShuffle.o 3585 3456 -3.6% 1.04x
ClassArrayGetter.o 3259 3148 -3.4% 1.04x
RC4.o 3172 3069 -3.2% 1.03x
PopFrontGeneric.o 2534 2464 -2.8% 1.03x
ObserverClosure.o 2494 2427 -2.7% 1.03x
ObserverPartiallyAppliedMethod.o 2560 2493 -2.6% 1.03x
SortIntPyramids.o 8906 8674 -2.6% 1.03x
ArrayAppend.o 22461 21901 -2.5% 1.03x
ArrayOfGenericRef.o 8218 8018 -2.4% 1.02x
Prims.o 11500 11222 -2.4% 1.02x
PrimsSplit.o 11552 11274 -2.4% 1.02x
ArrayOfRef.o 8499 8299 -2.4% 1.02x
Hanoi.o 2942 2875 -2.3% 1.02x
PopFront.o 3240 3171 -2.1% 1.02x
Queue.o 11924 11674 -2.1% 1.02x
Walsh.o 4095 4018 -1.9% 1.02x
SortArrayInClass.o 2699 2649 -1.9% 1.02x
RomanNumbers.o 5561 5460 -1.8% 1.02x
ArraySetElement.o 1108 1089 -1.7% 1.02x
Breadcrumbs.o 36560 36008 -1.5% 1.02x
ArrayInClass.o 4421 4359 -1.4% 1.01x
RangeAssignment.o 3027 2988 -1.3% 1.01x
DictionaryGroup.o 10409 10289 -1.2% 1.01x
ObjectiveCBridgingStubs.o 13978 13818 -1.1% 1.01x
RGBHistogram.o 20341 20134 -1.0% 1.01x
StringEdits.o 10111 10009 -1.0% 1.01x

Performance: -Onone

Regression OLD NEW DELTA RATIO
ArrayAppendSequence 85070 118220 +39.0% 0.72x
StringToDataEmpty 3400 4100 +20.6% 0.83x (?)
RangeOverlapsRange 11207 13418 +19.7% 0.84x (?)
StringToDataSmall 3500 4150 +18.6% 0.84x (?)
DataToStringSmall 5800 6700 +15.5% 0.87x (?)
RangeOverlapsClosedRange 13104 15011 +14.6% 0.87x (?)
ClosedRangeOverlapsClosedRange 9985 11267 +12.8% 0.89x
DataReplaceSmallBuffer 6100 6800 +11.5% 0.90x (?)
StringBuilderWithLongSubstring 5430 6000 +10.5% 0.91x (?)
ArrayPlusEqualSingleElementCollection 281953 309965 +9.9% 0.91x (?)
NormalizedIterator_fastPrenormal 1040 1130 +8.7% 0.92x (?)
Dict.FilterAllMatch.16k 2561 2766 +8.0% 0.93x (?)
Dict.FilterAllMatch.24k 3393 3658 +7.8% 0.93x (?)
Dict.FilterAllMatch.20k 2948 3178 +7.8% 0.93x (?)
 
Improvement OLD NEW DELTA RATIO
NSStringConversion.Mutable 5894 5481 -7.0% 1.08x (?)
StrComplexWalk 7900 7360 -6.8% 1.07x (?)

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

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - b0c9e69

@eeckstein
Copy link
Contributor Author

@swift-ci test macOS

@eeckstein eeckstein merged commit 67d311d into swiftlang:main Oct 13, 2020
@eeckstein eeckstein deleted the fix-side-effect-analysis branch October 13, 2020 14:33
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.

2 participants