Skip to content

Enable loop rotate when the header is exiting #79198

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

meg-gupta
Copy link
Contributor

@meg-gupta meg-gupta commented Feb 6, 2025

This was recently disabled but turns out to be an important case for loops with early exits.

Also fix a LoopRotate bug in ossa where an instruction producing an ownership result was hoisted, but its destroys were duplicated causing ownership errors.

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta meg-gupta marked this pull request as ready for review February 11, 2025 19:57
@meg-gupta meg-gupta requested a review from eeckstein as a code owner February 11, 2025 19:57
@meg-gupta
Copy link
Contributor Author

@swift-ci build toolchain

@meg-gupta
Copy link
Contributor Author

@swift-ci apple silicon benchmark

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@atrick
Copy link
Contributor

atrick commented Feb 12, 2025

Thank you! Yes, this is an important case.

@meg-gupta
Copy link
Contributor Author

@swift-ci test windows platform

@meg-gupta
Copy link
Contributor Author

@swift-ci test linux platform

@eeckstein
Copy link
Contributor

Did the benchmarks show any significant regressions?

@meg-gupta
Copy link
Contributor Author

@eeckstein benchmark results - https://ci.swift.org/view/Pull%20Requests/job/swift-PR-macos-perf-apple-silicon/421/console

------- Performance (arm64): -O -------

REGRESSION                                      OLD        NEW        DELTA     RATIO    
Set.filter.Int100.28k                           39.85      53.071     +33.2%    **0.75x**
Set.filter.Int100.16k                           22.906     30.333     +32.4%    **0.76x**
Set.filter.Int100.20k                           28.892     37.891     +31.1%    **0.76x**
Set.filter.Int100.24k                           35.319     45.426     +28.6%    **0.78x**
PrefixWhileArray                                35.919     44.294     +23.3%    **0.81x**
SortIntPyramid                                  377.632    450.556    +19.3%    **0.84x**
Set.isStrictSubset.Seq.Int0                     138.714    161.154    +16.2%    **0.86x**
SetSymmetricDifferenceInt25                     83.75      95.7       +14.3%    **0.88x**
DropFirstAnySequence                            24.414     27.32      +11.9%    **0.89x**
DictionaryCompactMapValuesOfCastValue           2436.48    2708.791   +11.2%    **0.90x**
DropFirstSequenceLazy                           24.289     26.603     +9.5%     **0.91x**
UTF8Decode                                      149.133    162.846    +9.2%     **0.92x**
DropFirstSequence                               24.337     26.548     +9.1%     **0.92x**
SetSymmetricDifferenceInt50                     91.429     99.45      +8.8%     **0.92x (?)**
UTF8Decode_InitFromCustom_noncontiguous_ascii   149.667    162.0      +8.2%     **0.92x (?)**
DropWhileArray                                  24.807     26.769     +7.9%     **0.93x**
Set.isStrictSuperset.Seq.Empty.Int              37.103     39.944     +7.7%     **0.93x**

IMPROVEMENT                                     OLD        NEW        DELTA     RATIO    
StringEqualPointerComparison                    85.6       0.0        -100.0%   **85601.00x**
Set.subtracting.Seq.Empty.Box                   81.167     60.256     -25.8%    **1.35x (?)**
Diffing.ReversedAlphabets                       99.524     87.043     -12.5%    **1.14x**
Chars2                                          2166.667   1916.071   -11.6%    **1.13x**
Diffing.PangramToAlphabet                       576.667    511.75     -11.3%    **1.13x**
CSVParsing.UTF16                                20.615     18.324     -11.1%    **1.13x**
BucketSort                                      59.132     52.667     -10.9%    **1.12x**
Diffing.Disparate                               81.636     72.917     -10.7%    **1.12x**
ParseInt.IntSmall.UncommonRadix                 91.625     82.2       -10.3%    **1.11x**
ParseInt.IntSmall.Decimal                       79.654     71.76      -9.9%     **1.11x (?)**
FrequenciesUsingReduce                          1154.286   1064.545   -7.8%     **1.08x (?)**

------- Code size: -O -------

REGRESSION                                     OLD      NEW      DELTA    RATIO  
DictionaryCompactMapValues.o                   12990    14690    +13.1%   **0.88x**
Histogram.o                                    2121     2357     +11.1%   **0.90x**
DictionaryCopy.o                               7185     7913     +10.1%   **0.91x**
WordCount.o                                    28583    31175    +9.1%    **0.92x**
DictionaryKeysContains.o                       5954     6390     +7.3%    **0.93x**
ReversedCollections.o                          6232     6688     +7.3%    **0.93x**
PrimsNonStrongRef.o                            70160    74920    +6.8%    **0.94x**
DictionarySubscriptDefault.o                   14010    14910    +6.4%    **0.94x**
DictTest2.o                                    7911     8419     +6.4%    **0.94x**
DictionaryRemove.o                             16096    17108    +6.3%    **0.94x**
StringEdits.o                                  6308     6676     +5.8%    **0.94x**
IntegerParsing.o                               63094    66746    +5.8%    **0.95x**
Prims.o                                        21457    22685    +5.7%    **0.95x**
PrimsSplit.o                                   21517    22745    +5.7%    **0.95x**
RemoveWhere.o                                  9536     10080    +5.7%    **0.95x**
RGBHistogram.o                                 16792    17712    +5.5%    **0.95x**
DictionaryLiteralTest.o                        921      969      +5.2%    **0.95x**
StrToInt.o                                     5098     5358     +5.1%    **0.95x**
DropFirst.o                                    9303     9759     +4.9%    **0.95x**
StringRemoveDupes.o                            4166     4366     +4.8%    **0.95x**
DictionaryBridgeToObjC.o                       3754     3934     +4.8%    **0.95x**
IndexPathTest.o                                6482     6774     +4.5%    **0.96x**
ReduceInto.o                                   7585     7921     +4.4%    **0.96x**
TwoSum.o                                       6838     7126     +4.2%    **0.96x**
RangeReplaceableCollectionPlusDefault.o        6149     6397     +4.0%    **0.96x**
DriverUtils.o                                  113184   117740   +4.0%    **0.96x**
Prefix.o                                       9276     9648     +4.0%    **0.96x**
CountAlgo.o                                    10472    10872    +3.8%    **0.96x**
DictionaryOfAnyHashableStrings.o               5670     5882     +3.7%    **0.96x**
Suffix.o                                       15100    15628    +3.5%    **0.97x**
StringMatch.o                                  3527     3647     +3.4%    **0.97x**
DictionaryGroup.o                              8673     8965     +3.4%    **0.97x**
Hash.o                                         16939    17507    +3.4%    **0.97x**
DictionarySwap.o                               14175    14639    +3.3%    **0.97x**
Integrate.o                                    1633     1685     +3.2%    **0.97x**
CSVParsing.o                                   40312    41560    +3.1%    **0.97x**
Array2D.o                                      1953     2009     +2.9%    **0.97x**
NibbleSort.o                                   9438     9694     +2.7%    **0.97x**
Fibonacci.o                                    1106     1134     +2.5%    **0.98x**
DictTest.o                                     20840    21348    +2.4%    **0.98x**
DictOfArraysToArrayOfDicts.o                   16790    17186    +2.4%    **0.98x**
FindStringNaive.o                              5089     5205     +2.3%    **0.98x**
CharacterProperties.o                          16528    16904    +2.3%    **0.98x**
LuhnAlgoLazy.o                                 10108    10332    +2.2%    **0.98x**
LuhnAlgoEager.o                                10112    10336    +2.2%    **0.98x**
SetTests.o                                     123745   126477   +2.2%    **0.98x**
ObjectiveCBridging.o                           45456    46432    +2.1%    **0.98x**
DiffingMyers.o                                 4673     4765     +2.0%    **0.98x**
Combos.o                                       3516     3584     +1.9%    **0.98x**
DictTest4.o                                    12500    12712    +1.7%    **0.98x**
RandomShuffle.o                                2414     2454     +1.7%    **0.98x**
TestsUtils.o                                   16668    16944    +1.7%    **0.98x**
DictTest3.o                                    12234    12435    +1.6%    **0.98x**
DictTest4Legacy.o                              12730    12938    +1.6%    **0.98x**
DropLast.o                                     14522    14754    +1.6%    **0.98x**
UTF16Decode.o                                  14574    14774    +1.4%    **0.99x**
SortLargeExistentials.o                        15182    15382    +1.3%    **0.99x**
UTF8Decode.o                                   15434    15630    +1.3%    **0.99x**
SortIntPyramids.o                              7464     7556     +1.2%    **0.99x**
Breadcrumbs.o                                  34399    34815    +1.2%    **0.99x**
CxxSetToCollection.o                           6195     6267     +1.2%    **0.99x**
SortArrayInClass.o                             1816     1836     +1.1%    **0.99x**
ErrorHandling.o                                2310     2334     +1.0%    **0.99x**

IMPROVEMENT                                    OLD      NEW      DELTA    RATIO  
NaiveRangeReplaceableCollectionConformance.o   6786     6622     -2.4%    **1.02x**
SortLettersInPlace.o                           7221     7097     -1.7%    **1.02x**
LazyFilter.o                                   6005     5917     -1.5%    **1.01x**
ArrayInClass.o                                 2631     2595     -1.4%    **1.01x**

####### Testing optimization level -Osize #######
  
------- Performance (arm64): -Osize -------

REGRESSION                                                 OLD        NEW         DELTA     RATIO     
DataAppendDataLargeToMedium                                5870.833   8291.892    +41.2%    **0.71x (?)**
Data.init.Sequence.64kB.Count                              28.567     38.018      +33.1%    **0.75x** 
Dict.FilterAllMatch.28k                                    40.317     53.522      +32.8%    **0.75x** 
Data.init.Sequence.64kB.Count.I                            28.606     37.964      +32.7%    **0.75x** 
Dict.FilterAllMatch.16k                                    23.043     30.564      +32.6%    **0.75x** 
Dict.FilterAllMatch.20k                                    28.988     38.125      +31.5%    **0.76x** 
Data.init.Sequence.2049B.Count.I                           48.773     63.571      +30.3%    **0.77x** 
Set.filter.Int100.16k                                      23.391     30.479      +30.3%    **0.77x** 
Set.filter.Int100.28k                                      41.0       53.326      +30.1%    **0.77x** 
Data.init.Sequence.2047B.Count.I                           48.767     63.412      +30.0%    **0.77x** 
Dict.FilterAllMatch.24k                                    35.197     45.704      +29.9%    **0.77x** 
Set.filter.Int100.20k                                      29.53      38.015      +28.7%    **0.78x** 
Set.filter.Int100.24k                                      35.836     45.593      +27.2%    **0.79x** 
Data.init.Sequence.809B.Count.I                            43.08      54.625      +26.8%    **0.79x** 
Data.init.Sequence.809B.Count                              43.06      54.575      +26.7%    **0.79x** 
PrefixWhileArray                                           35.683     44.3        +24.1%    **0.81x** 
DataAppendDataSmallToLarge                                 5890.625   7266.667    +23.4%    **0.81x (?)**
Data.init.Sequence.513B.Count.I                            48.767     59.972      +23.0%    **0.81x** 
CxxStringConversion.cxx.to.swift                           50.364     61.75       +22.6%    **0.82x (?)**
SetSubtractingInt100                                       30.567     37.34       +22.2%    **0.82x** 
Set.isDisjoint.Seq.Int.Empty                               32.813     39.944      +21.7%    **0.82x** 
Data.init.Sequence.511B.Count.I                            48.773     59.029      +21.0%    **0.83x** 
RemoveWhereSwapInts                                        9.729      11.744      +20.7%    **0.83x** 
DataAppendDataMediumToLarge                                5312.329   6387.5      +20.2%    **0.83x (?)**
DataReplaceLarge                                           5965.714   7109.677    +19.2%    **0.84x (?)**
ArrayAppendLazyMap                                         669.333    787.5       +17.7%    **0.85x (?)**
Set.isSubset.Seq.Int0                                      139.0      162.154     +16.7%    **0.86x (?)**
Set.isDisjoint.Seq.Int100                                  50.791     59.077      +16.3%    **0.86x** 
Set.isStrictSubset.Seq.Int.Empty                           51.372     59.611      +16.0%    **0.86x** 
Set.isDisjoint.Seq.Empty.Int                               35.661     41.373      +16.0%    **0.86x** 
SortIntPyramid                                             389.783    450.909     +15.7%    **0.86x** 
Set.isDisjoint.Box.Empty                                   37.092     42.804      +15.4%    **0.87x** 
Set.isStrictSubset.Seq.Int0                                139.333    159.857     +14.7%    **0.87x (?)**
CharIndexing_tweet_unicodeScalars_Backwards                8968.0     10288.889   +14.7%    **0.87x** 
CharIndexing_ascii_unicodeScalars_Backwards                4504.0     5157.647    +14.5%    **0.87x** 
Set.intersection.Seq.Int0                                  27.797     31.482      +13.3%    **0.88x** 
Set.isDisjoint.Int.Empty                                   34.242     38.518      +12.5%    **0.89x** 
UTF8Decode                                                 175.917    197.727     +12.4%    **0.89x** 
Set.isDisjoint.Empty.Int                                   37.102     41.37       +11.5%    **0.90x** 
Set.isDisjoint.Empty.Box                                   38.518     42.804      +11.1%    **0.90x** 
CharIndexing_punctuated_unicodeScalars_Backwards           1218.462   1350.137    +10.8%    **0.90x** 
Set.isDisjoint.Int0                                        147.357    163.231     +10.8%    **0.90x** 
CharIndexing_japanese_unicodeScalars_Backwards             8018.182   8788.0      +9.6%     **0.91x** 
SetSubtractingInt0                                         29.472     32.25       +9.4%     **0.91x (?)**
CharIndexing_chinese_unicodeScalars_Backwards              5002.222   5461.176    +9.2%     **0.92x** 
CharIndexing_russian_unicodeScalars_Backwards              5298.824   5782.5      +9.1%     **0.92x** 
CharIndexing_punctuatedJapanese_unicodeScalars_Backwards   1179.701   1283.333    +8.8%     **0.92x** 
SetIntersectionInt0                                        30.418     33.057      +8.7%     **0.92x** 
DropWhileArray                                             24.735     26.769      +8.2%     **0.92x** 
DictionaryCompactMapValuesOfCastValue                      2457.0     2655.22     +8.1%     **0.93x** 
CharIndexing_korean_unicodeScalars_Backwards               7003.333   7556.667    +7.9%     **0.93x** 

IMPROVEMENT                                                OLD        NEW         DELTA     RATIO     
StringEqualPointerComparison                               114.15     0.0         -100.0%   **114151.00x**
RemoveWhereMoveInts                                        9.901      7.098       -28.3%    **1.39x** 
Data.append.Sequence.64kB.Count.RE.I                       38.679     28.781      -25.6%    **1.34x** 
Data.append.Sequence.64kB.Count.RE                         38.3       29.143      -23.9%    **1.31x** 
Data.append.Sequence.809B.Count.RE.I                       66.636     54.692      -17.9%    **1.22x** 
DropFirstSequence                                          46.761     38.667      -17.3%    **1.21x** 
DropFirstSequenceLazy                                      46.766     38.673      -17.3%    **1.21x** 
Data.append.Sequence.809B.Count.RE                         66.625     55.27       -17.0%    **1.21x** 
SetIsSubsetBox0                                            124.0      103.13      -16.8%    **1.20x (?)**
DataAppendSequence                                         6545.455   5523.077    -15.6%    **1.19x** 
String.initRepeating.longMixStr.Count100                   527.75     447.8       -15.1%    **1.18x** 
Set.subtracting.Seq.Empty.Box                              76.227     65.636      -13.9%    **1.16x (?)**
ArrayAppendGenericStructs                                  1123.333   972.857     -13.4%    **1.15x (?)**
BucketSort                                                 60.917     52.778      -13.4%    **1.15x** 
Set.isDisjoint.Smaller.Box0                                211.091    184.917     -12.4%    **1.14x (?)**
Diffing.ReversedAlphabets                                  98.591     87.4        -11.4%    **1.13x** 
Diffing.PangramToAlphabet                                  564.0      501.0       -11.2%    **1.13x** 
Diffing.Disparate                                          81.3       72.6        -10.7%    **1.12x** 
UTF16Decode.initFromCustom.cont                            279.143    251.714     -9.8%     **1.11x** 
Calculator                                                 128.056    115.5       -9.8%     **1.11x** 
UTF16Decode.initFromCustom.noncont                         287.0      259.75      -9.5%     **1.10x** 
ParseInt.IntSmall.Decimal                                  297.0      271.556     -8.6%     **1.09x (?)**
Chars2                                                     2982.432   2732.5      -8.4%     **1.09x** 
Set.isSubset.Seq.Int.Empty                                 54.214     49.932      -7.9%     **1.09x** 
ParseInt.IntSmall.UncommonRadix                            339.429    312.714     -7.9%     **1.09x** 
ObjectiveCBridgeFromNSString                               702.813    648.056     -7.8%     **1.08x (?)**
Set.isSubset.Seq.Empty.Int                                 37.102     34.242      -7.7%     **1.08x** 
OpenClose                                                  42.804     39.942      -6.7%     **1.07x (?)**

------- Code size: -Osize -------

REGRESSION                                OLD      NEW      DELTA    RATIO  
DictionaryCompactMapValues.o              11806    13334    +12.9%   **0.89x**
DictionaryCopy.o                          6145     6833     +11.2%   **0.90x**
SortArrayInClass.o                        2012     2212     +9.9%    **0.91x**
WordCount.o                               27431    30123    +9.8%    **0.91x**
DictionaryRemove.o                        13380    14408    +7.7%    **0.93x**
IntegerParsing.o                          47246    50482    +6.8%    **0.94x**
RGBHistogram.o                            14782    15770    +6.7%    **0.94x**
DictTest3.o                               8718     9294     +6.6%    **0.94x**
StringEdits.o                             6380     6780     +6.3%    **0.94x**
DictionaryKeysContains.o                  5580     5904     +5.8%    **0.95x**
ReversedCollections.o                     5456     5752     +5.4%    **0.95x**
SetTests.o                                95465    100629   +5.4%    **0.95x**
Histogram.o                               1141     1201     +5.3%    **0.95x**
CountAlgo.o                               10368    10880    +4.9%    **0.95x**
Suffix.o                                  12410    13018    +4.9%    **0.95x**
CSVParsing.o                              34952    36556    +4.6%    **0.96x**
DictionaryBridgeToObjC.o                  2994     3130     +4.5%    **0.96x**
StringMatch.o                             2571     2687     +4.5%    **0.96x**
ArrayAppend.o                             15529    16189    +4.3%    **0.96x**
CharacterProperties.o                     13976    14564    +4.2%    **0.96x**
RangeReplaceableCollectionPlusDefault.o   6053     6297     +4.0%    **0.96x**
ErrorHandling.o                           2028     2108     +3.9%    **0.96x**
StrToInt.o                                5074     5274     +3.9%    **0.96x**
DictTest4.o                               8472     8804     +3.9%    **0.96x**
Hash.o                                    12576    13060    +3.8%    **0.96x**
DictTest4Legacy.o                         8718     9050     +3.8%    **0.96x**
DictionaryGroup.o                         8325     8637     +3.7%    **0.96x**
RemoveWhere.o                             8780     9096     +3.6%    **0.97x**
Phonebook.o                               7635     7890     +3.3%    **0.97x**
DictTest2.o                               6114     6294     +2.9%    **0.97x**
TestsUtils.o                              15884    16308    +2.7%    **0.97x**
Fibonacci.o                               1058     1086     +2.6%    **0.97x**
DriverUtils.o                             102674   105334   +2.6%    **0.97x**
DictionarySwap.o                          12155    12455    +2.5%    **0.98x**
UTF16Decode.o                             13698    13990    +2.1%    **0.98x**
DictionarySubscriptDefault.o              9555     9755     +2.1%    **0.98x**
Array2D.o                                 1885     1921     +1.9%    **0.98x**
SortLargeExistentials.o                   12446    12682    +1.9%    **0.98x**
LuhnAlgoLazy.o                            10769    10973    +1.9%    **0.98x**
LuhnAlgoEager.o                           10773    10977    +1.9%    **0.98x**
CxxSetToCollection.o                      5655     5759     +1.8%    **0.98x**
StringRemoveDupes.o                       2654     2702     +1.8%    **0.98x**
ObjectiveCBridging.o                      37220    37876    +1.8%    **0.98x**
Integrate.o                               1609     1637     +1.7%    **0.98x**
Combos.o                                  3564     3624     +1.7%    **0.98x**
RC4.o                                     2460     2500     +1.6%    **0.98x**
BucketSort.o                              6421     6521     +1.6%    **0.98x**
FlattenDistanceFromTo.o                   7406     7518     +1.5%    **0.99x**
UTF8Decode.o                              14032    14236    +1.5%    **0.99x**
ReduceInto.o                              5505     5585     +1.5%    **0.99x**
DictOfArraysToArrayOfDicts.o              13981    14181    +1.4%    **0.99x**
DataBenchmarks.o                          38457    38973    +1.3%    **0.99x**
PrefixWhile.o                             9065     9177     +1.2%    **0.99x**
DiffingMyers.o                            4979     5039     +1.2%    **0.99x**
TwoSum.o                                  5662     5722     +1.1%    **0.99x**

IMPROVEMENT                               OLD      NEW      DELTA    RATIO  
SequenceAlgos.o                           14906    14454    -3.0%    **1.03x**
FindStringNaive.o                         4813     4697     -2.4%    **1.02x**
StaticArray.o                             7600     7516     -1.1%    **1.01x**

####### Testing optimization level -Onone #######
------- Performance (arm64): -Onone -------

REGRESSION                             OLD       NEW       DELTA    RATIO    
CxxStringConversion.swift.to.cxx       12.474    15.517    +24.4%   **0.80x (?)**
Sim2DArray                             3658.0    4267.0    +16.6%   **0.86x (?)**
ArraySetElement                        542.5     616.333   +13.6%   **0.88x (?)**
XorLoop                                3038.0    3429.0    +12.9%   **0.89x (?)**
DataCreateMedium                       83600.0   94250.0   +12.7%   **0.89x**
Data.init.Sequence.64kB.Count.I        711.667   779.0     +9.5%    **0.91x (?)**
Data.append.Sequence.64kB.Count        711.667   779.0     +9.5%    **0.91x**
Data.append.Sequence.64kB.Count.I      711.667   779.0     +9.5%    **0.91x**
Data.init.Sequence.64kB.Count          711.667   778.667   +9.4%    **0.91x (?)**
Data.init.Sequence.2047B.Count.I       1120.5    1225.5    +9.4%    **0.91x (?)**
Data.init.Sequence.2049B.Count.I       1121.5    1226.0    +9.3%    **0.91x**
Data.init.Sequence.809B.Count.I        897.0     980.0     +9.3%    **0.92x (?)**
Data.init.Sequence.809B.Count          897.0     979.5     +9.2%    **0.92x (?)**
Data.append.Sequence.809B.Count        911.0     994.5     +9.2%    **0.92x (?)**
Data.append.Sequence.809B.Count.I      911.0     994.5     +9.2%    **0.92x (?)**
Data.init.Sequence.511B.Count.I        865.5     943.5     +9.0%    **0.92x (?)**
Data.init.Sequence.513B.Count.I        869.0     947.0     +9.0%    **0.92x (?)**
DataCreateSmall                        11390.0   12410.0   +9.0%    **0.92x**
Data.init.Sequence.64kB.Count0.I       767.333   828.5     +8.0%    **0.93x (?)**
Data.init.Sequence.2047B.Count0.I      1232.0    1327.0    +7.7%    **0.93x**
Data.init.Sequence.809B.Count0.I       999.0     1076.0    +7.7%    **0.93x**
Data.init.Sequence.513B.Count0.I       968.5     1043.0    +7.7%    **0.93x (?)**
Data.init.Sequence.64kB.Count0         767.667   826.5     +7.7%    **0.93x (?)**
Data.append.Sequence.809B.Count0       999.0     1075.5    +7.7%    **0.93x**
String.replaceSubrange.ArrChar.Small   19.709    21.218    +7.7%    **0.93x (?)**
Data.append.Sequence.809B.Count0.I     999.5     1076.0    +7.7%    **0.93x**
Data.append.Sequence.64kB.Count0.I     784.667   844.0     +7.6%    **0.93x**

IMPROVEMENT                            OLD       NEW       DELTA    RATIO    
ArrayAppendGenericStructs              1012.0    690.0     -31.8%   **1.47x (?)**
Diffing.PangramToAlphabet              570.333   508.75    -10.8%   **1.12x**
Set.filter.Int100.24k                  63.769    57.047    -10.5%   **1.12x**
Set.filter.Int100.20k                  53.489    47.904    -10.4%   **1.12x**
Set.filter.Int100.16k                  43.214    38.774    -10.3%   **1.11x**
Set.filter.Int100.28k                  76.0      68.306    -10.1%   **1.11x**
Diffing.ReversedAlphabets              97.087    87.615    -9.8%    **1.11x**
Diffing.Disparate                      80.0      72.667    -9.2%    **1.10x**
NormalizedIterator_ascii               109.059   101.5     -6.9%    **1.07x (?)**
RawBuffer.copyContents                 12.176    11.358    -6.7%    **1.07x (?)**

------- Code size: -swiftlibs -------

REGRESSION                        OLD      NEW      DELTA   RATIO  
libswift_StringProcessing.dylib   491520   507904   +3.3%   **0.97x**

@eeckstein
Copy link
Contributor

Hm, the code size regressions are about the improvements I saw when I added the restriction.
Can you take a quick look and see if the code size regressions can be avoided?

@atrick
Copy link
Contributor

atrick commented Feb 12, 2025

Hm, the code size regressions are about the improvements I saw when I added the restriction. Can you take a quick look and see if the code size regressions can be avoided?

I have not looked at this pass at all recently, but one strategy is to limit rotation to only hoist branches that are likely loop invariant, meaning the rotated condition will dominate the same loop condition.

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