Skip to content

IRGen: Always eliminate frame pointers of leaf functions #31921

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

Conversation

aschwaighofer
Copy link
Contributor

rdar://20933449

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please benchmark

@CodaFi
Copy link
Contributor

CodaFi commented May 20, 2020

So we tried this a few times in the past and there were some shocking code size regressions that need to be investigated.

@CodaFi
Copy link
Contributor

CodaFi commented May 20, 2020

rdar://59172266

@swift-ci
Copy link
Contributor

Performance: -O

Regression OLD NEW DELTA RATIO
Data.append.Sequence.64kB.Count.RE.I 21 44 +109.5% 0.48x
Data.append.Sequence.64kB.Count.RE 21 44 +109.5% 0.48x
Data.append.Sequence.809B.Count.RE.I 60 91 +51.7% 0.66x
Data.append.Sequence.809B.Count.RE 60 90 +50.0% 0.67x
DataAppendSequence 6000 8900 +48.3% 0.67x
EqualStringSubstring 23 31 +34.8% 0.74x
EqualSubstringSubstring 23 30 +30.4% 0.77x
LessSubstringSubstring 23 30 +30.4% 0.77x (?)
EqualSubstringSubstringGenericEquatable 23 30 +30.4% 0.77x
EqualSubstringString 23 30 +30.4% 0.77x
LessSubstringSubstringGenericComparable 23 30 +30.4% 0.77x
MapReduceClass2 19 24 +26.3% 0.79x
RemoveWhereMoveInts 17 21 +23.5% 0.81x (?)
MapReduce 185 218 +17.8% 0.85x
Array2D 4112 4832 +17.5% 0.85x (?)
ArrayPlusEqualFiveElementCollection 4514 5291 +17.2% 0.85x
ArraySetElement 262 305 +16.4% 0.86x
Data.append.Sequence.64kB.Count.I 25 29 +16.0% 0.86x
Data.append.Sequence.64kB.Count 25 29 +16.0% 0.86x (?)
PrefixWhileSequence 178 206 +15.7% 0.86x
DataSubscriptSmall 13 15 +15.4% 0.87x
PrefixWhileAnySeqCntRange 178 205 +15.2% 0.87x (?)
PrefixWhileAnySeqCRangeIter 179 205 +14.5% 0.87x
RemoveWhereSwapInts 36 41 +13.9% 0.88x (?)
DistinctClassFieldAccesses 177 201 +13.6% 0.88x
NopDeinit 8800 9900 +12.5% 0.89x (?)
RandomShuffleLCG2 416 464 +11.5% 0.90x (?)
SuffixSequence 271 302 +11.4% 0.90x (?)
MapReduceSequence 378 419 +10.8% 0.90x (?)
ObjectiveCBridgeStubNSDateRefAccess 486 536 +10.3% 0.91x (?)
AngryPhonebook.Strasse 137 151 +10.2% 0.91x (?)
AngryPhonebook.Armenian 157 172 +9.6% 0.91x (?)
AngryPhonebook.Cyrillic 168 184 +9.5% 0.91x (?)
DropLastSequenceLazy 338 369 +9.2% 0.92x (?)
MapReduceString 44 48 +9.1% 0.92x (?)
RangeAssignment 209 227 +8.6% 0.92x (?)
 
Improvement OLD NEW DELTA RATIO
ArrayAppendLazyMap 1800 1400 -22.2% 1.29x
ArrayAppendStrings 2520 1980 -21.4% 1.27x
CaptureProp 2170 1770 -18.4% 1.23x
ObjectiveCBridgeStubDateAccess 159 130 -18.2% 1.22x
StringEqualPointerComparison 130 108 -16.9% 1.20x
PrefixSequenceLazy 31 26 -16.1% 1.19x (?)
PrefixSequence 31 26 -16.1% 1.19x
ProtocolDispatch2 76 65 -14.5% 1.17x (?)
SequenceAlgosRange 1740 1490 -14.4% 1.17x (?)
UTF8Decode_InitFromCustom_contiguous 163 140 -14.1% 1.16x (?)
ProtocolDispatch 227 196 -13.7% 1.16x
SortSortedStrings 44 38 -13.6% 1.16x
UTF8Decode_InitDecoding 162 140 -13.6% 1.16x (?)
StringUTF16Builder 240 210 -12.5% 1.14x
DataCountMedium 17 15 -11.8% 1.13x
DataCountSmall 19 17 -10.5% 1.12x (?)
Histogram 347 311 -10.4% 1.12x (?)
DataSubscriptMedium 41 37 -9.8% 1.11x
PointerArithmetics 23900 21700 -9.2% 1.10x (?)
CharacterLiteralsLarge 69 63 -8.7% 1.10x
Data.hash.Empty 47 43 -8.5% 1.09x (?)
UTF8Decode_InitFromCustom_noncontiguous 327 302 -7.6% 1.08x (?)
PrefixArray 14 13 -7.1% 1.08x (?)
DictionaryOfAnyHashableStrings_insert 3192 2968 -7.0% 1.08x (?)
StringInterpolationSmall 1320 1230 -6.8% 1.07x (?)

Code size: -O

Regression OLD NEW DELTA RATIO
StringEnum.o 13311 13687 +2.8% 0.97x
 
Improvement OLD NEW DELTA RATIO
CharacterLiteralsSmall.o 1714 1586 -7.5% 1.08x
PolymorphicCalls.o 13629 12760 -6.4% 1.07x
Radix2CooleyTukey.o 7672 7320 -4.6% 1.05x
NIOChannelPipeline.o 4931 4750 -3.7% 1.04x
OpaqueConsumingUsers.o 2527 2447 -3.2% 1.03x
ObjectiveCBridgingStubs.o 16741 16213 -3.2% 1.03x
ChaCha.o 14361 13937 -3.0% 1.03x
BinaryFloatingPointConversionFromBinaryInteger.o 29641 28785 -2.9% 1.03x
TestsUtils.o 28768 27955 -2.8% 1.03x
CharacterLiteralsLarge.o 1154 1122 -2.8% 1.03x
NSStringConversion.o 14252 13871 -2.7% 1.03x
ArrayOfRef.o 9075 8846 -2.5% 1.03x
ErrorHandling.o 3491 3403 -2.5% 1.03x
UTF8Decode.o 25091 24459 -2.5% 1.03x
ArrayOfPOD.o 2998 2926 -2.4% 1.02x
CaptureProp.o 1003 979 -2.4% 1.02x
Codable.o 31375 30642 -2.3% 1.02x
DevirtualizeProtocolComposition.o 2038 1993 -2.2% 1.02x
DataBenchmarks.o 67821 66336 -2.2% 1.02x
NibbleSort.o 13288 13000 -2.2% 1.02x
ArrayInClass.o 4527 4431 -2.1% 1.02x
ArrayOfGenericRef.o 8678 8497 -2.1% 1.02x
OpenClose.o 3664 3592 -2.0% 1.02x
ArrayLiteral.o 3461 3397 -1.8% 1.02x
RangeOverlaps.o 6136 6024 -1.8% 1.02x
RandomTree.o 12375 12154 -1.8% 1.02x
DictionaryLiteral.o 1382 1358 -1.7% 1.02x
AnyHashableWithAClass.o 3609 3548 -1.7% 1.02x
HTTP2StateMachine.o 5792 5696 -1.7% 1.02x
PrimsNonStrongRef.o 120320 118379 -1.6% 1.02x
StringWalk.o 40305 39705 -1.5% 1.02x
NSError.o 1435 1414 -1.5% 1.01x
Histogram.o 3302 3256 -1.4% 1.01x
ExistentialPerformance.o 50652 49951 -1.4% 1.01x
AngryPhonebook.o 10147 10011 -1.3% 1.01x
RandomShuffle.o 3632 3584 -1.3% 1.01x
DictionaryCopy.o 9510 9385 -1.3% 1.01x
ObjectiveCNoBridgingStubs.o 9260 9140 -1.3% 1.01x
Breadcrumbs.o 37479 37018 -1.2% 1.01x
COWTree.o 11476 11335 -1.2% 1.01x
ByteSwap.o 1768 1747 -1.2% 1.01x
SequenceAlgos.o 21999 21738 -1.2% 1.01x
ObserverClosure.o 2462 2433 -1.2% 1.01x
ReversedCollections.o 9270 9161 -1.2% 1.01x
CharacterProperties.o 22593 22329 -1.2% 1.01x
ObserverPartiallyAppliedMethod.o 2509 2480 -1.2% 1.01x
ObjectiveCBridging.o 64727 64007 -1.1% 1.01x
Exclusivity.o 4818 4765 -1.1% 1.01x
ArrayAppend.o 25903 25626 -1.1% 1.01x
LuhnAlgoEager.o 12789 12653 -1.1% 1.01x
LuhnAlgoLazy.o 12789 12653 -1.1% 1.01x
RecursiveOwnedParameter.o 2270 2246 -1.1% 1.01x
Phonebook.o 9159 9063 -1.0% 1.01x

Performance: -Osize

Regression OLD NEW DELTA RATIO
SuffixArrayLazy 4 9 +125.0% 0.44x
DropLastArray 4 9 +125.0% 0.44x
DropLastCountableRangeLazy 4 9 +125.0% 0.44x
PrefixCountableRangeLazy 13 26 +100.0% 0.50x
DropFirstArrayLazy 14 26 +85.7% 0.54x
DropFirstArray 14 26 +85.7% 0.54x
Data.append.Sequence.64kB.Count.RE 19 29 +52.6% 0.66x
Data.init.Sequence.64kB.Count.RE.I 20 29 +45.0% 0.69x
Data.append.Sequence.64kB.Count.RE.I 20 29 +45.0% 0.69x
Data.init.Sequence.64kB.Count.RE 20 29 +45.0% 0.69x
BitCount 124 174 +40.3% 0.71x (?)
FlattenListFlatMap 3375 4596 +36.2% 0.73x (?)
ArrayAppendSequence 370 500 +35.1% 0.74x (?)
EqualSubstringSubstring 23 31 +34.8% 0.74x
EqualStringSubstring 23 31 +34.8% 0.74x
EqualSubstringSubstringGenericEquatable 23 31 +34.8% 0.74x
EqualSubstringString 23 31 +34.8% 0.74x
ArrayAppendLatin1Substring 19404 25704 +32.5% 0.75x
ArrayAppendAsciiSubstring 19008 25164 +32.4% 0.76x
ArrayAppendUTF16Substring 19044 25164 +32.1% 0.76x
LessSubstringSubstring 24 31 +29.2% 0.77x (?)
LessSubstringSubstringGenericComparable 24 31 +29.2% 0.77x
Data.init.Sequence.809B.Count.RE 45 58 +28.9% 0.78x
Data.init.Sequence.809B.Count.RE.I 45 58 +28.9% 0.78x
DataCountMedium 15 19 +26.7% 0.79x
DataAppendSequence 6100 7300 +19.7% 0.84x
Data.append.Sequence.809B.Count.RE 62 73 +17.7% 0.85x
ObjectiveCBridgeStubDateAccess 130 152 +16.9% 0.86x
MapReduceSequence 404 468 +15.8% 0.86x (?)
Data.append.Sequence.809B.Count.RE.I 62 71 +14.5% 0.87x
CharIteration_japanese_unicodeScalars 3440 3920 +14.0% 0.88x
CharIteration_korean_unicodeScalars 2600 2960 +13.8% 0.88x
DropWhileAnySeqCntRange 98 111 +13.3% 0.88x (?)
CharIteration_tweet_unicodeScalars 4280 4840 +13.1% 0.88x
NopDeinit 8800 9900 +12.5% 0.89x (?)
CharIteration_chinese_unicodeScalars 2040 2280 +11.8% 0.89x
DataCountSmall 17 19 +11.8% 0.89x
CharIteration_ascii_unicodeScalars 2200 2440 +10.9% 0.90x
FlattenListLoop 2940 3252 +10.6% 0.90x (?)
PrefixAnySeqCRangeIterLazy 98 108 +10.2% 0.91x (?)
PrefixAnySeqCntRangeLazy 98 108 +10.2% 0.91x (?)
MapReduceAnyCollection 216 237 +9.7% 0.91x (?)
MapReduce 218 239 +9.6% 0.91x (?)
Set.isDisjoint.Int.Empty 53 58 +9.4% 0.91x (?)
ArrayPlusEqualFiveElementCollection 4440 4810 +8.3% 0.92x (?)
SuffixAnyCollection 37 40 +8.1% 0.93x (?)
ArraySetElement 262 283 +8.0% 0.93x (?)
CharIteration_punctuated_unicodeScalars 520 560 +7.7% 0.93x
 
Improvement OLD NEW DELTA RATIO
ArrayAppendRepeatCol 850 410 -51.8% 2.07x
PrefixArrayLazy 26 13 -50.0% 2.00x
PrefixArray 26 13 -50.0% 2.00x
MapReduceLazyCollectionShort 67 35 -47.8% 1.91x
DropLastArrayLazy 9 5 -44.4% 1.80x
PrefixSequenceLazy 40 26 -35.0% 1.54x
PrefixSequence 40 26 -35.0% 1.54x
SequenceAlgosRange 2170 1520 -30.0% 1.43x
ObjectiveCBridgeStubFromNSDate 4100 2990 -27.1% 1.37x (?)
DropFirstSequence 44 33 -25.0% 1.33x
DropFirstSequenceLazy 44 33 -25.0% 1.33x
ArrayAppendStrings 2460 1940 -21.1% 1.27x (?)
DropFirstCountableRangeLazy 17 14 -17.6% 1.21x (?)
PolymorphicCalls 12 10 -16.7% 1.20x
MapReduceString 49 41 -16.3% 1.20x (?)
SortSortedStrings 45 39 -13.3% 1.15x
UTF8Decode_InitFromCustom_contiguous 163 143 -12.3% 1.14x
SequenceAlgosContiguousArray 1820 1600 -12.1% 1.14x (?)
UTF8Decode_InitDecoding 162 143 -11.7% 1.13x
DataCreateEmpty 90 80 -11.1% 1.12x (?)
DataSubscriptSmall 19 17 -10.5% 1.12x (?)
IterateData 933 844 -9.5% 1.11x (?)
OpenClose 67 61 -9.0% 1.10x (?)
Histogram 351 321 -8.5% 1.09x (?)
Data.hash.Empty 47 43 -8.5% 1.09x (?)
StringBuilder 217 200 -7.8% 1.08x (?)
SequenceAlgosUnfoldSequence 930 860 -7.5% 1.08x (?)
DictionaryOfAnyHashableStrings_insert 3234 2996 -7.4% 1.08x (?)
StringAdder 266 248 -6.8% 1.07x (?)

Code size: -Osize

Improvement OLD NEW DELTA RATIO
PolymorphicCalls.o 13405 12456 -7.1% 1.08x
CharacterLiteralsSmall.o 1809 1681 -7.1% 1.08x
TestsUtils.o 22160 20963 -5.4% 1.06x
NIOChannelPipeline.o 4875 4662 -4.4% 1.05x
DevirtualizeProtocolComposition.o 2134 2041 -4.4% 1.05x
ArrayOfPOD.o 3558 3406 -4.3% 1.04x
ObjectiveCBridgingStubs.o 15333 14741 -3.9% 1.04x
ChaCha.o 12097 11673 -3.5% 1.04x
UTF8Decode.o 24419 23587 -3.4% 1.04x
ErrorHandling.o 3481 3369 -3.2% 1.03x
StringEnum.o 13413 12997 -3.1% 1.03x
ArrayLiteral.o 3229 3133 -3.0% 1.03x
DataBenchmarks.o 56125 54472 -2.9% 1.03x
ArrayOfRef.o 9235 8966 -2.9% 1.03x
NSStringConversion.o 12588 12223 -2.9% 1.03x
Radix2CooleyTukey.o 7311 7103 -2.8% 1.03x
BinaryFloatingPointConversionFromBinaryInteger.o 29593 28769 -2.8% 1.03x
OpaqueConsumingUsers.o 2630 2558 -2.7% 1.03x
CharacterLiteralsLarge.o 1217 1185 -2.6% 1.03x
Codable.o 31559 30730 -2.6% 1.03x
AnyHashableWithAClass.o 3897 3796 -2.6% 1.03x
NSError.o 1787 1742 -2.5% 1.03x
NibbleSort.o 12832 12512 -2.5% 1.03x
Histogram.o 2834 2765 -2.4% 1.02x
RandomTree.o 12103 11818 -2.4% 1.02x
PrimsNonStrongRef.o 101804 99495 -2.3% 1.02x
LuhnAlgoEager.o 15948 15615 -2.1% 1.02x
LuhnAlgoLazy.o 15948 15615 -2.1% 1.02x
RandomShuffle.o 3878 3798 -2.1% 1.02x
ArrayOfGenericRef.o 8910 8729 -2.0% 1.02x
ObjectiveCNoBridgingStubs.o 8724 8548 -2.0% 1.02x
ExistentialPerformance.o 42740 41887 -2.0% 1.02x
ObserverClosure.o 2860 2804 -2.0% 1.02x
ObserverPartiallyAppliedMethod.o 2907 2851 -1.9% 1.02x
RangeOverlaps.o 5854 5742 -1.9% 1.02x
ObjectAllocation.o 4645 4557 -1.9% 1.02x
Prims.o 12235 12019 -1.8% 1.02x
PrimsSplit.o 12287 12071 -1.8% 1.02x
StringWalk.o 35047 34447 -1.7% 1.02x
Hanoi.o 3296 3240 -1.7% 1.02x
Breadcrumbs.o 36888 36275 -1.7% 1.02x
SequenceAlgos.o 22167 21802 -1.6% 1.02x
ObserverUnappliedMethod.o 5425 5337 -1.6% 1.02x
StringBuilder.o 8103 7975 -1.6% 1.02x
AngryPhonebook.o 9609 9459 -1.6% 1.02x
Exclusivity.o 4675 4603 -1.5% 1.02x
ArrayAppend.o 23255 22898 -1.5% 1.02x
DictionaryCopy.o 8242 8117 -1.5% 1.02x
StackPromo.o 2193 2161 -1.5% 1.01x
ProtocolDispatch2.o 2195 2163 -1.5% 1.01x
ObjectiveCBridging.o 60639 59799 -1.4% 1.01x
Phonebook.o 9247 9119 -1.4% 1.01x
LazyFilter.o 8067 7958 -1.4% 1.01x
ObserverForwarderStruct.o 3008 2968 -1.3% 1.01x
ArrayInClass.o 4836 4772 -1.3% 1.01x
CharacterProperties.o 22673 22377 -1.3% 1.01x
HTTP2StateMachine.o 5614 5542 -1.3% 1.01x
COWTree.o 11692 11551 -1.2% 1.01x
IterateData.o 1992 1968 -1.2% 1.01x
ByteSwap.o 1808 1787 -1.2% 1.01x
DictionarySwap.o 16485 16301 -1.1% 1.01x
ReversedCollections.o 8777 8681 -1.1% 1.01x
StringReplaceSubrange.o 5313 5257 -1.1% 1.01x
OpenClose.o 3808 3768 -1.1% 1.01x
StringComparison.o 36120 35747 -1.0% 1.01x
DriverUtils.o 124339 123075 -1.0% 1.01x
TwoSum.o 3710 3673 -1.0% 1.01x
DictionaryRemove.o 11256 11144 -1.0% 1.01x

Performance: -Onone

Regression OLD NEW DELTA RATIO
LessSubstringSubstringGenericComparable 27 35 +29.6% 0.77x
EqualSubstringSubstringGenericEquatable 27 34 +25.9% 0.79x
LessSubstringSubstring 28 35 +25.0% 0.80x
EqualSubstringString 28 35 +25.0% 0.80x (?)
EqualSubstringSubstring 28 34 +21.4% 0.82x
EqualStringSubstring 28 34 +21.4% 0.82x
CharacterLiteralsLarge 338 384 +13.6% 0.88x (?)
AngryPhonebook.Strasse 137 151 +10.2% 0.91x (?)
AngryPhonebook.Armenian 157 172 +9.6% 0.91x (?)
AngryPhonebook.Cyrillic 168 184 +9.5% 0.91x (?)
 
Improvement OLD NEW DELTA RATIO
ArrayAppendStrings 2470 1970 -20.2% 1.25x (?)
UTF8Decode_InitFromCustom_contiguous 174 150 -13.8% 1.16x
UTF8Decode_InitDecoding 170 147 -13.5% 1.16x (?)
Data.hash.Empty 111 100 -9.9% 1.11x (?)
RandomIntegersLCG 28894 26250 -9.2% 1.10x (?)
OpenClose 420 382 -9.0% 1.10x (?)
DataAccessBytesMedium 106 98 -7.5% 1.08x (?)
RandomDoubleLCG 37654 35114 -6.7% 1.07x (?)
DictionaryBridgeToObjC_Access 593 553 -6.7% 1.07x (?)
DataCreateEmpty 760 710 -6.6% 1.07x (?)

Code size: -swiftlibs

Regression OLD NEW DELTA RATIO
libswiftSwiftReflectionTest.dylib 24576 28672 +16.7% 0.86x
libswiftDarwin.dylib 28672 32768 +14.3% 0.88x
libswiftAccelerate.dylib 258048 290816 +12.7% 0.89x
libswiftModelIO.dylib 32768 36864 +12.5% 0.89x
libswiftCloudKit.dylib 69632 77824 +11.8% 0.89x
libswiftAppKit.dylib 73728 81920 +11.1% 0.90x
libswiftNaturalLanguage.dylib 36864 40960 +11.1% 0.90x
libswiftNetwork.dylib 155648 172032 +10.5% 0.90x
libswiftSwiftOnoneSupport.dylib 155648 172032 +10.5% 0.90x
libswiftCoreGraphics.dylib 61440 65536 +6.7% 0.94x
libswiftCore.dylib 4087808 4231168 +3.5% 0.97x
libswiftFoundation.dylib 1486848 1527808 +2.8% 0.97x
libswiftStdlibUnittest.dylib 327680 335872 +2.5% 0.98x
libswift_Differentiation.dylib 180224 184320 +2.3% 0.98x
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 mini
  Model Identifier: Macmini8,1
  Processor Name: 6-Core Intel Core i7
  Processor Speed: 3.2 GHz
  Number of Processors: 1
  Total Number of Cores: 6
  L2 Cache (per Core): 256 KB
  L3 Cache: 12 MB
  Memory: 64 GB

@aschwaighofer
Copy link
Contributor Author

aschwaighofer commented May 20, 2020

The code size regressions are due to increased exception handling frame info.

% LIB=libswiftDarwin.dylib ; size -m swift-macosx-x86_64-before/lib/swift/macosx/$LIB ; size -m swift-macosx-x86_64/lib/swift/macosx/$LIB     
Segment __TEXT: 32768
        Section __text: 17466
        Section __stubs: 834
        Section __stub_helper: 1406
        Section __const: 856
        Section __swift5_typeref: 115
        Section __cstring: 213
        Section __swift5_reflstr: 44
        Section __swift5_fieldmd: 28
        Section __swift5_builtin: 40
        Section __swift5_assocty: 72
        Section __swift5_proto: 40
        Section __swift5_types: 12
        Section __info_plist: 567
        Section __unwind_info: 276
        Section __eh_frame: 184
        total 22153
Segment __DATA: 4096
        Section __nl_symbol_ptr: 8
        Section __got: 368
        Section __la_symbol_ptr: 1112
        Section __const: 96
        Section __objc_imageinfo: 8
        Section __data: 56
        Section __bss: 1424
        total 3072
Segment __LINKEDIT: 102400
total 139264
Segment __TEXT: 40960
        Section __text: 17093
        Section __stubs: 834
        Section __stub_helper: 1406
        Section __const: 856
        Section __swift5_typeref: 115
        Section __cstring: 226
        Section __swift5_reflstr: 44
        Section __swift5_fieldmd: 28
        Section __swift5_builtin: 40
        Section __swift5_assocty: 72
        Section __swift5_proto: 40
        Section __swift5_types: 12
        Section __info_plist: 567
        Section __unwind_info: 2572
        Section __eh_frame: 8664
        total 32569
Segment __DATA: 4096
        Section __nl_symbol_ptr: 8
        Section __got: 368
        Section __la_symbol_ptr: 1112
        Section __const: 96
        Section __objc_imageinfo: 8
        Section __data: 56
        Section __bss: 1424
        total 3072
Segment __LINKEDIT: 102400
total 147456

@aschwaighofer
Copy link
Contributor Author

Moving code code from the instruction cache onto the disk (eh frame info is cold) at the expense of some disk space is a good trade off IMO.

@compnerd
Copy link
Member

compnerd commented May 20, 2020

Does it make sense to have a knob for this (similar to -fno-omit-frame-pointer and -fno-omit-leaf-frame-pointer in watson cc - yes, clang has -mno-omit-leaf-frame-pointer but the spelling is more confusing)?

Rationale: I can see it being useful for freestanding code which needs to unwind itself.

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please benchmark

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 7829c9eeef8407e0562b0bf5cd89fa4a31154ee7

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 7829c9eeef8407e0562b0bf5cd89fa4a31154ee7

@swift-ci
Copy link
Contributor

Performance: -O

Regression OLD NEW DELTA RATIO
Data.append.Sequence.64kB.Count.RE.I 21 44 +109.5% 0.48x
Data.append.Sequence.64kB.Count.RE 21 44 +109.5% 0.48x
DataAppendSequence 6000 8900 +48.3% 0.67x
Data.append.Sequence.809B.Count.RE.I 60 88 +46.7% 0.68x
Data.append.Sequence.809B.Count.RE 61 88 +44.3% 0.69x
RemoveWhereMoveInts 17 21 +23.5% 0.81x
MapReduceClass2 19 23 +21.1% 0.83x
ArrayPlusEqualFiveElementCollection 4403 5254 +19.3% 0.84x
Array2D 4096 4832 +18.0% 0.85x
MapReduce 185 218 +17.8% 0.85x
ArraySetElement 262 305 +16.4% 0.86x (?)
Data.append.Sequence.64kB.Count.I 25 29 +16.0% 0.86x
Data.append.Sequence.64kB.Count 25 29 +16.0% 0.86x
DataSubscriptSmall 13 15 +15.4% 0.87x
PrefixWhileSequence 178 205 +15.2% 0.87x
PrefixWhileAnySeqCRangeIter 178 205 +15.2% 0.87x (?)
PrefixWhileAnySeqCntRange 178 205 +15.2% 0.87x
MapReduceSequence 374 423 +13.1% 0.88x (?)
FlattenListFlatMap 5665 6393 +12.9% 0.89x (?)
NopDeinit 8800 9900 +12.5% 0.89x (?)
RandomShuffleLCG2 416 464 +11.5% 0.90x
SuffixSequence 271 302 +11.4% 0.90x (?)
FlattenListLoop 3214 3580 +11.4% 0.90x (?)
MapReduceString 44 49 +11.4% 0.90x (?)
MapReduceAnyCollection 216 238 +10.2% 0.91x (?)
NSStringConversion.Long 577 626 +8.5% 0.92x (?)
IterateData 805 868 +7.8% 0.93x (?)
ObjectiveCBridgeStubNSDateRefAccess 506 545 +7.7% 0.93x (?)
 
Improvement OLD NEW DELTA RATIO
ArrayAppendLazyMap 1790 1400 -21.8% 1.28x (?)
ArrayAppendStrings 2450 1940 -20.8% 1.26x (?)
CaptureProp 2170 1770 -18.4% 1.23x
ObjectiveCBridgeStubDateAccess 159 130 -18.2% 1.22x
StringEqualPointerComparison 130 108 -16.9% 1.20x (?)
PrefixSequenceLazy 31 26 -16.1% 1.19x (?)
PrefixSequence 31 26 -16.1% 1.19x
SortSortedStrings 44 37 -15.9% 1.19x
ProtocolDispatch2 76 65 -14.5% 1.17x
SequenceAlgosRange 1740 1490 -14.4% 1.17x
DataCountMedium 17 15 -11.8% 1.13x
UTF8Decode_InitFromCustom_contiguous_ascii 207 183 -11.6% 1.13x (?)
DataCountSmall 19 17 -10.5% 1.12x (?)
ProtocolDispatch 218 196 -10.1% 1.11x (?)
DataSubscriptMedium 41 37 -9.8% 1.11x (?)
PointerArithmetics 23900 21700 -9.2% 1.10x
Histogram 347 316 -8.9% 1.10x (?)
DictionaryOfAnyHashableStrings_insert 3248 2982 -8.2% 1.09x (?)
NormalizedIterator_fastPrenormal 660 610 -7.6% 1.08x (?)
ReversedArray2 96 89 -7.3% 1.08x (?)
Set.subtracting.Empty.Int 28 26 -7.1% 1.08x (?)
PrefixArray 14 13 -7.1% 1.08x (?)

Code size: -O

Regression OLD NEW DELTA RATIO
StringEnum.o 13311 13687 +2.8% 0.97x
 
Improvement OLD NEW DELTA RATIO
CharacterLiteralsSmall.o 1714 1586 -7.5% 1.08x
PolymorphicCalls.o 13629 12760 -6.4% 1.07x
Radix2CooleyTukey.o 7672 7320 -4.6% 1.05x
NIOChannelPipeline.o 4931 4750 -3.7% 1.04x
OpaqueConsumingUsers.o 2527 2447 -3.2% 1.03x
ObjectiveCBridgingStubs.o 16741 16213 -3.2% 1.03x
ChaCha.o 14361 13937 -3.0% 1.03x
BinaryFloatingPointConversionFromBinaryInteger.o 29641 28785 -2.9% 1.03x
TestsUtils.o 28768 27955 -2.8% 1.03x
CharacterLiteralsLarge.o 1154 1122 -2.8% 1.03x
NSStringConversion.o 14252 13871 -2.7% 1.03x
ArrayOfRef.o 9075 8846 -2.5% 1.03x
ErrorHandling.o 3491 3403 -2.5% 1.03x
UTF8Decode.o 25091 24459 -2.5% 1.03x
ArrayOfPOD.o 2998 2926 -2.4% 1.02x
CaptureProp.o 1003 979 -2.4% 1.02x
Codable.o 31375 30642 -2.3% 1.02x
DevirtualizeProtocolComposition.o 2038 1993 -2.2% 1.02x
DataBenchmarks.o 67821 66336 -2.2% 1.02x
NibbleSort.o 13288 13000 -2.2% 1.02x
ArrayInClass.o 4527 4431 -2.1% 1.02x
ArrayOfGenericRef.o 8678 8497 -2.1% 1.02x
OpenClose.o 3664 3592 -2.0% 1.02x
ArrayLiteral.o 3461 3397 -1.8% 1.02x
RangeOverlaps.o 6136 6024 -1.8% 1.02x
RandomTree.o 12375 12154 -1.8% 1.02x
DictionaryLiteral.o 1382 1358 -1.7% 1.02x
AnyHashableWithAClass.o 3609 3548 -1.7% 1.02x
HTTP2StateMachine.o 5792 5696 -1.7% 1.02x
PrimsNonStrongRef.o 120320 118379 -1.6% 1.02x
StringWalk.o 40305 39705 -1.5% 1.02x
NSError.o 1435 1414 -1.5% 1.01x
Histogram.o 3302 3256 -1.4% 1.01x
ExistentialPerformance.o 50652 49951 -1.4% 1.01x
AngryPhonebook.o 10147 10011 -1.3% 1.01x
RandomShuffle.o 3632 3584 -1.3% 1.01x
DictionaryCopy.o 9510 9385 -1.3% 1.01x
ObjectiveCNoBridgingStubs.o 9260 9140 -1.3% 1.01x
Breadcrumbs.o 37479 37018 -1.2% 1.01x
COWTree.o 11476 11335 -1.2% 1.01x
ByteSwap.o 1768 1747 -1.2% 1.01x
SequenceAlgos.o 21999 21738 -1.2% 1.01x
ObserverClosure.o 2462 2433 -1.2% 1.01x
ReversedCollections.o 9270 9161 -1.2% 1.01x
CharacterProperties.o 22593 22329 -1.2% 1.01x
ObserverPartiallyAppliedMethod.o 2509 2480 -1.2% 1.01x
ObjectiveCBridging.o 64727 64007 -1.1% 1.01x
Exclusivity.o 4818 4765 -1.1% 1.01x
ArrayAppend.o 25903 25626 -1.1% 1.01x
LuhnAlgoEager.o 12789 12653 -1.1% 1.01x
LuhnAlgoLazy.o 12789 12653 -1.1% 1.01x
RecursiveOwnedParameter.o 2270 2246 -1.1% 1.01x
Phonebook.o 9159 9063 -1.0% 1.01x

Performance: -Osize

Regression OLD NEW DELTA RATIO
SuffixArrayLazy 4 9 +125.0% 0.44x
DropLastArray 4 9 +125.0% 0.44x
DropLastCountableRangeLazy 4 9 +125.0% 0.44x
PrefixCountableRangeLazy 13 26 +100.0% 0.50x
DropFirstArrayLazy 14 26 +85.7% 0.54x
DropFirstArray 14 26 +85.7% 0.54x
Data.append.Sequence.64kB.Count.RE.I 19 30 +57.9% 0.63x
Data.append.Sequence.64kB.Count.RE 19 30 +57.9% 0.63x
Data.init.Sequence.64kB.Count.RE.I 20 29 +45.0% 0.69x
Data.init.Sequence.64kB.Count.RE 20 29 +45.0% 0.69x
BitCount 124 167 +34.7% 0.74x
ArrayAppendLatin1Substring 19404 25668 +32.3% 0.76x
ArrayAppendAsciiSubstring 19008 25128 +32.2% 0.76x (?)
ArrayAppendUTF16Substring 19044 25164 +32.1% 0.76x
ArrayAppendSequence 380 500 +31.6% 0.76x (?)
DataCountMedium 15 19 +26.7% 0.79x
Data.init.Sequence.809B.Count.RE 47 58 +23.4% 0.81x
Data.init.Sequence.809B.Count.RE.I 47 58 +23.4% 0.81x
Data.append.Sequence.809B.Count.RE 59 72 +22.0% 0.82x
Data.append.Sequence.809B.Count.RE.I 59 72 +22.0% 0.82x
DataAppendSequence 6100 7300 +19.7% 0.84x
ObjectiveCBridgeStubDateAccess 130 152 +16.9% 0.86x (?)
MapReduceSequence 406 470 +15.8% 0.86x (?)
CharIteration_japanese_unicodeScalars 3440 3920 +14.0% 0.88x (?)
CharIteration_korean_unicodeScalars 2600 2960 +13.8% 0.88x (?)
CharIteration_chinese_unicodeScalars 2040 2320 +13.7% 0.88x
DropWhileAnySeqCntRange 98 111 +13.3% 0.88x (?)
CharIteration_tweet_unicodeScalars 4280 4840 +13.1% 0.88x (?)
NopDeinit 8800 9900 +12.5% 0.89x (?)
FlattenListLoop 2906 3256 +12.0% 0.89x (?)
DataCountSmall 17 19 +11.8% 0.89x (?)
CharIteration_ascii_unicodeScalars 2200 2440 +10.9% 0.90x (?)
Array2D 4208 4640 +10.3% 0.91x (?)
PrefixAnySeqCRangeIterLazy 98 108 +10.2% 0.91x
PrefixAnySeqCntRangeLazy 98 108 +10.2% 0.91x (?)
MapReduceAnyCollection 216 237 +9.7% 0.91x (?)
MapReduce 218 239 +9.6% 0.91x (?)
Set.isDisjoint.Int.Empty 53 58 +9.4% 0.91x (?)
DataSetCountSmall 87 95 +9.2% 0.92x (?)
ArrayPlusEqualFiveElementCollection 4440 4810 +8.3% 0.92x (?)
CharIteration_punctuatedJapanese_unicodeScalars 480 520 +8.3% 0.92x
CSVParsing.UTF8 24 26 +8.3% 0.92x (?)
SuffixAnyCollection 37 40 +8.1% 0.93x (?)
CharIteration_russian_unicodeScalars 2480 2680 +8.1% 0.93x (?)
ArraySetElement 262 283 +8.0% 0.93x (?)
CharIteration_punctuated_unicodeScalars 520 560 +7.7% 0.93x
 
Improvement OLD NEW DELTA RATIO
ArrayAppendRepeatCol 850 410 -51.8% 2.07x
PrefixArrayLazy 26 13 -50.0% 2.00x
PrefixArray 26 13 -50.0% 2.00x
MapReduceLazyCollectionShort 67 35 -47.8% 1.91x
DropLastArrayLazy 9 5 -44.4% 1.80x
PrefixSequenceLazy 40 26 -35.0% 1.54x
PrefixSequence 40 26 -35.0% 1.54x
SuffixCountableRangeLazy 6 4 -33.3% 1.50x (?)
SequenceAlgosRange 2170 1520 -30.0% 1.43x
ObjectiveCBridgeStubFromNSDate 4000 3000 -25.0% 1.33x (?)
DropFirstSequence 44 33 -25.0% 1.33x
DropFirstSequenceLazy 44 33 -25.0% 1.33x
ArrayAppendStrings 2450 1990 -18.8% 1.23x
DropFirstCountableRangeLazy 17 14 -17.6% 1.21x (?)
SortSortedStrings 46 38 -17.4% 1.21x
PolymorphicCalls 12 10 -16.7% 1.20x (?)
MapReduceString 48 42 -12.5% 1.14x
SequenceAlgosContiguousArray 1820 1600 -12.1% 1.14x (?)
DataCreateEmpty 90 80 -11.1% 1.12x (?)
DataSubscriptSmall 19 17 -10.5% 1.12x (?)
CharacterLiteralsLarge 71 65 -8.5% 1.09x
Histogram 350 321 -8.3% 1.09x (?)
SequenceAlgosUnfoldSequence 930 860 -7.5% 1.08x (?)
LazilyFilteredArrays2 4000 3700 -7.5% 1.08x (?)
Set.subtracting.Empty.Int 28 26 -7.1% 1.08x (?)
DictionaryOfAnyHashableStrings_insert 3276 3052 -6.8% 1.07x (?)
Set.isSuperset.Seq.Int50 88 82 -6.8% 1.07x

Code size: -Osize

Improvement OLD NEW DELTA RATIO
PolymorphicCalls.o 13405 12456 -7.1% 1.08x
CharacterLiteralsSmall.o 1809 1681 -7.1% 1.08x
TestsUtils.o 22160 20963 -5.4% 1.06x
NIOChannelPipeline.o 4875 4662 -4.4% 1.05x
DevirtualizeProtocolComposition.o 2134 2041 -4.4% 1.05x
ArrayOfPOD.o 3558 3406 -4.3% 1.04x
ObjectiveCBridgingStubs.o 15333 14741 -3.9% 1.04x
ChaCha.o 12097 11673 -3.5% 1.04x
UTF8Decode.o 24419 23587 -3.4% 1.04x
ErrorHandling.o 3481 3369 -3.2% 1.03x
StringEnum.o 13413 12997 -3.1% 1.03x
ArrayLiteral.o 3229 3133 -3.0% 1.03x
DataBenchmarks.o 56125 54472 -2.9% 1.03x
ArrayOfRef.o 9235 8966 -2.9% 1.03x
NSStringConversion.o 12588 12223 -2.9% 1.03x
Radix2CooleyTukey.o 7311 7103 -2.8% 1.03x
BinaryFloatingPointConversionFromBinaryInteger.o 29593 28769 -2.8% 1.03x
OpaqueConsumingUsers.o 2630 2558 -2.7% 1.03x
CharacterLiteralsLarge.o 1217 1185 -2.6% 1.03x
Codable.o 31559 30730 -2.6% 1.03x
AnyHashableWithAClass.o 3897 3796 -2.6% 1.03x
NSError.o 1787 1742 -2.5% 1.03x
NibbleSort.o 12832 12512 -2.5% 1.03x
Histogram.o 2834 2765 -2.4% 1.02x
RandomTree.o 12103 11818 -2.4% 1.02x
PrimsNonStrongRef.o 101804 99495 -2.3% 1.02x
LuhnAlgoEager.o 15948 15615 -2.1% 1.02x
LuhnAlgoLazy.o 15948 15615 -2.1% 1.02x
RandomShuffle.o 3878 3798 -2.1% 1.02x
ArrayOfGenericRef.o 8910 8729 -2.0% 1.02x
ObjectiveCNoBridgingStubs.o 8724 8548 -2.0% 1.02x
ExistentialPerformance.o 42740 41887 -2.0% 1.02x
ObserverClosure.o 2860 2804 -2.0% 1.02x
ObserverPartiallyAppliedMethod.o 2907 2851 -1.9% 1.02x
RangeOverlaps.o 5854 5742 -1.9% 1.02x
ObjectAllocation.o 4645 4557 -1.9% 1.02x
Prims.o 12235 12019 -1.8% 1.02x
PrimsSplit.o 12287 12071 -1.8% 1.02x
StringWalk.o 35047 34447 -1.7% 1.02x
Hanoi.o 3296 3240 -1.7% 1.02x
Breadcrumbs.o 36888 36275 -1.7% 1.02x
SequenceAlgos.o 22167 21802 -1.6% 1.02x
ObserverUnappliedMethod.o 5425 5337 -1.6% 1.02x
StringBuilder.o 8103 7975 -1.6% 1.02x
AngryPhonebook.o 9609 9459 -1.6% 1.02x
Exclusivity.o 4675 4603 -1.5% 1.02x
ArrayAppend.o 23255 22898 -1.5% 1.02x
DictionaryCopy.o 8242 8117 -1.5% 1.02x
StackPromo.o 2193 2161 -1.5% 1.01x
ProtocolDispatch2.o 2195 2163 -1.5% 1.01x
ObjectiveCBridging.o 60639 59799 -1.4% 1.01x
Phonebook.o 9247 9119 -1.4% 1.01x
LazyFilter.o 8067 7958 -1.4% 1.01x
ObserverForwarderStruct.o 3008 2968 -1.3% 1.01x
ArrayInClass.o 4836 4772 -1.3% 1.01x
CharacterProperties.o 22673 22377 -1.3% 1.01x
HTTP2StateMachine.o 5614 5542 -1.3% 1.01x
COWTree.o 11692 11551 -1.2% 1.01x
IterateData.o 1992 1968 -1.2% 1.01x
ByteSwap.o 1808 1787 -1.2% 1.01x
DictionarySwap.o 16485 16301 -1.1% 1.01x
ReversedCollections.o 8777 8681 -1.1% 1.01x
StringReplaceSubrange.o 5313 5257 -1.1% 1.01x
OpenClose.o 3808 3768 -1.1% 1.01x
StringComparison.o 36120 35747 -1.0% 1.01x
DriverUtils.o 124339 123075 -1.0% 1.01x
TwoSum.o 3710 3673 -1.0% 1.01x
DictionaryRemove.o 11256 11144 -1.0% 1.01x

Performance: -Onone

Improvement OLD NEW DELTA RATIO
ArrayAppendStrings 2460 1950 -20.7% 1.26x (?)
OpenClose 436 374 -14.2% 1.17x (?)
ArrayOfPOD 722 644 -10.8% 1.12x (?)
ChaCha 37193 34047 -8.5% 1.09x (?)
RC4 12782 11745 -8.1% 1.09x (?)
MonteCarloE 3016960 2800200 -7.2% 1.08x (?)
ArraySubscript 293084 272752 -6.9% 1.07x (?)
ProtocolDispatch2 3631 3391 -6.6% 1.07x (?)
BitCount 41367 38657 -6.6% 1.07x (?)

Code size: -swiftlibs

Regression OLD NEW DELTA RATIO
libswiftSwiftReflectionTest.dylib 24576 28672 +16.7% 0.86x
libswiftDarwin.dylib 28672 32768 +14.3% 0.88x
libswiftAccelerate.dylib 258048 290816 +12.7% 0.89x
libswiftModelIO.dylib 32768 36864 +12.5% 0.89x
libswiftCloudKit.dylib 69632 77824 +11.8% 0.89x
libswiftAppKit.dylib 73728 81920 +11.1% 0.90x
libswiftNaturalLanguage.dylib 36864 40960 +11.1% 0.90x
libswiftNetwork.dylib 155648 172032 +10.5% 0.90x
libswiftSwiftOnoneSupport.dylib 155648 172032 +10.5% 0.90x
libswiftCoreGraphics.dylib 61440 65536 +6.7% 0.94x
libswiftCore.dylib 4091904 4239360 +3.6% 0.97x
libswiftFoundation.dylib 1486848 1527808 +2.8% 0.97x
libswiftStdlibUnittest.dylib 327680 335872 +2.5% 0.98x
libswift_Differentiation.dylib 180224 184320 +2.3% 0.98x
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 mini
  Model Identifier: Macmini8,1
  Processor Name: 6-Core Intel Core i7
  Processor Speed: 3.2 GHz
  Number of Processors: 1
  Total Number of Cores: 6
  L2 Cache (per Core): 256 KB
  L3 Cache: 12 MB
  Memory: 64 GB

@atrick
Copy link
Contributor

atrick commented May 21, 2020

After @rjmccall 's patch #31906, should we just use the clang default attribute unless Swift users override it with -no-fp-elim?

@atrick
Copy link
Contributor

atrick commented May 21, 2020

I have no idea where those perf regressions would come from. I didn't see any regressions on arm64, but feel free to double check...

@aschwaighofer
Copy link
Contributor Author

@atrick AFAICT clang sets "frame-pointer"="all" (see also my comment on slack)

@aschwaighofer
Copy link
Contributor Author

I have looked at DataAppendSequence and other than the omitted frame instructions there is no difference in the function where we spend our time. So some kinda of cache effect (alignment or otherwise).

@atrick
Copy link
Contributor

atrick commented May 21, 2020

My questions are

Why are we setting the frame pointer explicitly at all when we just want to inherit clang's behavior (at least after John's patch)?

And in the case that -no-omit-frame-pointer is used, why do we override it both in createClangCodeGenerator and setHasFramePointer?

@aschwaighofer aschwaighofer force-pushed the irgen_frame_pointer_non_leaf_only branch from 2627295 to addf7d8 Compare May 21, 2020 19:04
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 26272956ac9c073a3e5e08ba3d2b2fab2749c76d

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 26272956ac9c073a3e5e08ba3d2b2fab2749c76d

@aschwaighofer
Copy link
Contributor Author

Of course we can't cherry-pick this version to 5.3 since John's change won't be there. Going back to the previous change.

@aschwaighofer aschwaighofer force-pushed the irgen_frame_pointer_non_leaf_only branch from addf7d8 to 109813f Compare May 21, 2020 20:20
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - addf7d8ebd5f77e5d100dbb454b21ada0320b804

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - addf7d8ebd5f77e5d100dbb454b21ada0320b804

@aschwaighofer
Copy link
Contributor Author

@atrick Can you review this change for 5.3?

Ultimately on master i will add a third commit so that we set and use clang's setting see #31944. But for 5.3 we can't do that because John's change is not on 5.3.

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@atrick
Copy link
Contributor

atrick commented May 22, 2020

This code makes it seem as if we're still telling clang to emit all frame pointers

  CGO.setFramePointer(Opts.DisableFPElim
                          ? clang::CodeGenOptions::FramePointerKind::All
                          : clang::CodeGenOptions::FramePointerKind::None);

I don't know if you should remove the code completely, or add a check for DisableFPElim and set it to FramePointerKind::NonLeaf

@aschwaighofer
Copy link
Contributor Author

aschwaighofer commented May 22, 2020

This only affects C functions that we import (i.e inline foo()) until we remove the call to setHasFramePointer in IRGenModule::constructInitialFnAttributes.

@aschwaighofer aschwaighofer force-pushed the irgen_frame_pointer_non_leaf_only branch from db0135f to 35dceab Compare May 22, 2020 12:40
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 109813f

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 109813f

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 35dceab

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 35dceab

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.

Looks like this patch will do the right thing. Approved for 5.3!

For after John's patch: the design of the flags is still unacceptably bad. There should only be one place (in the driver) where we interpret the sense of the options: disable/enable/emit/omit whatever! There should be only one place where we check the IRGen flags--why is it different for imported functions? Those flags should first indicate whether the Swift driver has overridden clang's frame-pointer default so it's obvious to someone reading the code that the IRGen options are normally irrelevant. There should probably be two IRGen options:

  1. overrideLLVMFramePointerAttribute = T/F (clearly for experimentation only)
  2. framePointerAttributeOverride = none/nonleaf/all (clearly only only when the swift driver sets a flag)

Or make flag #2 optional if that's possible.

Finally, some Swift functions will override both LLVM and Swift driver flags to suppress frame pointers. And this should all be commented.

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - e6f0cbc

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - e6f0cbc

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.

isArch64() check LGTM

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 617f1c3

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 617f1c3

@aschwaighofer aschwaighofer merged commit 45810d0 into swiftlang:master May 22, 2020
@compnerd
Copy link
Member

This seems to have caused a regression on most of the bots. I think that the test needs to be adjusted. Reverting until this can be looked at.

@aschwaighofer
Copy link
Contributor Author

Which bot?

@aschwaighofer
Copy link
Contributor Author

Failures in framepointer_arm64.sil should be addressed by #31987.

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.

5 participants