Skip to content

Conversation

@eeckstein
Copy link
Contributor

Even if a store is not dominating the loop exits, it makes sense to move it out of the loop if the pre-header also as a store to the same memory location.
When this is done, dead-store-elimination can then most likely remove the store in the pre-header.

@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
FlattenListFlatMap 7456 9273 +24.4% 0.80x (?)
FlattenListLoop 4092 4918 +20.2% 0.83x (?)
 
Improvement OLD NEW DELTA RATIO
PrefixWhileAnyCollectionLazy 33 28 -15.2% 1.18x (?)
PrefixWhileAnySeqCRangeIterLazy 33 28 -15.2% 1.18x
PrefixWhileAnySeqCntRangeLazy 33 28 -15.2% 1.18x

Code size: -O

Improvement OLD NEW DELTA RATIO
Prefix.o 18448 17664 -4.2% 1.04x

Performance: -Osize

Improvement OLD NEW DELTA RATIO
FlattenListFlatMap 7654 6951 -9.2% 1.10x (?)
String.data.Medium 111 102 -8.1% 1.09x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 43600 40400 -7.3% 1.08x (?)

Code size: -Osize

Performance: -Onone

Regression OLD NEW DELTA RATIO
CharacterPropertiesFetch 5280 6390 +21.0% 0.83x (?)
ObjectiveCBridgeStubToNSDate2 630 710 +12.7% 0.89x (?)

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 - 9ac86dbb01ee6f55a87bcb2c6fb83426396a4602

@eeckstein
Copy link
Contributor Author

@swift-ci smoke test macOS

@eeckstein eeckstein requested a review from atrick May 15, 2020 17:50
Copy link
Contributor

Choose a reason for hiding this comment

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

If %cond was never true, then this is storing the wrong value ??

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 should use a different name for %v2 here. It's actually the value which comes out of the SSAUpdater.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, I would hope it's inserting a phi inside the loop

Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be worth writing a unit test for the example from the documentation?

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 test I added is exactly this. I added a check for the phi argument.

Even if a store is not dominating the loop exits, it makes sense to move it out of the loop if the pre-header also as a store to the same memory location.
When this is done, dead-store-elimination can then most likely remove the store in the pre-header.
@eeckstein
Copy link
Contributor Author

@swift-ci smoke test

@eeckstein
Copy link
Contributor Author

@swift-ci smoke test linux

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.

LGTM

@eeckstein eeckstein merged commit dca0209 into swiftlang:master May 18, 2020
@eeckstein eeckstein deleted the licm-improvement branch May 18, 2020 17:32
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.

3 participants