CodeMotion: Make release sinking more aggressive by looking through casts

Also, only hoist releases into switch regions late in the pipeline.

I made retain sinking more aggressive so that we can move more retains into (and
then hopefully out of) switch regions.

Hoisting releases up into switch regions blocks moving the retains out of the
switch region. To remove retain/releases we would have to iterate between
codemotion and global-arc-opts. Instead just don't move releases into switch
regions until late in the pipeline (the late iteration of the SSAPasses).

This fixes the remaining regressions from the array changes in RC4. And gives
some nice further gains.

-O results speedup(SU) = minbefore/minafter:

TEST``````````SMPL`MIN``MAX```MEAN``SD```MEDIAN`MIN``MAX``MEAN`SD```MEDIAN``SU
Forest````````10```4985`5456``5319``156``5376```4423`4914`4700`169``4789````1.12
ImageProc`````10```7852`7873``7858``6````7857```8260`8272`8264`3````8263````0.95
InsertionSort`10```6098`6109``6104``3````6104```6720`6736`6726`4````6727````0.90
PrimeNum``````10```9202`18296`12514`2690`12368``4098`7552`5953`1164`6319````2.24
Prims`````````10```2058`3486``2787``513``3025```1877`2429`2049`196``2007````1.09
QuickSort`````10```6101`6116``6107``5````6107```6380`6415`6396`11```6398````0.95
RC4```````````10```8639`8684``8655``14```8653```7821`7926`7876`32```7880````1.10
Richards``````10```2243`2254``2249``3````2250```1729`1740`1736`3````1738````1.29
StrToInt``````10```4298`4317``4309``6````4310```4090`4107`4097`6````4098````1.05
StringWalk````10```6478`6511``6486``10```6482```5784`5797`5790`4````5790````1.11
Walsh`````````10```5971`7374``6831``515``7103```4780`4803`4789`7````4788````1.24

InsertionSort: Looking at the profile of insertion sort the regression is not
due to increased retain/release traffic. In fact, it is hard to tell where
those 10% come from.

Quicksort: The quicksort function is identical and takes 95% of the time. Not
clear where the 5% are coming from. It is not extra retain/release traffic
AFAICT.

ImageProc: Same story as InsertionSort.

rdar://17653593

Swift SVN r22694
This commit is contained in:
Arnold Schwaighofer
2014-10-12 22:57:20 +00:00
parent bb46f4bbd9
commit e5084ae319
5 changed files with 83 additions and 27 deletions

View File

@@ -415,7 +415,7 @@ static void runCommandLineSelectedPasses(SILModule *Module,
PM.add(createEarlyInliner());
break;
case PassKind::CodeMotion:
PM.add(createCodeMotion());
PM.add(createCodeMotion(true));
break;
case PassKind::LowerAggregateInstrs:
PM.add(createLowerAggregate());