Skip to content

[SILGen] force immeidate LValue assignment cleanups. #18969

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
merged 1 commit into from
Aug 25, 2018
Merged

[SILGen] force immeidate LValue assignment cleanups. #18969

merged 1 commit into from
Aug 25, 2018

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Aug 24, 2018

In SILGenFunction::emitAssignToLValue, use an ArgumentScope instead of
a FormalEvaluationScope. This ensures that the lifetime of objects
needed to materialize each LValue component do not overlap.

For example in this tuple assignment:

public func testTupleAssign(x: inout [Int]) {
(x[0], x[1]) = (0, 1)
}

Array.subscript.nativeOwningMutableAddressor keeps a reference to the
array across the assignment, unnecessarily forcing a copy of the
array.

Fixes SR-8621: SILGen creates destroys for tuple assignment at the
wrong places.

In SILGenFunction::emitAssignToLValue, use an ArgumentScope instead of
a FormalEvaluationScope. This ensures that the lifetime of objects
needed to materialize each LValue component do not overlap.

For example in this tuple assignment:

public func testTupleAssign(x: inout [Int]) {
  (x[0], x[1]) = (0, 1)
}

Array.subscript.nativeOwningMutableAddressor keeps a reference to the
array across the assignment, unnecessarily forcing a copy of the
array.

Fixes SR-8621: SILGen creates destroys for tuple assignment at the
wrong places.
@atrick
Copy link
Contributor Author

atrick commented Aug 24, 2018

@swift-ci test.

@atrick
Copy link
Contributor Author

atrick commented Aug 24, 2018

@swift-ci test source compatibility.

@atrick atrick requested a review from rjmccall August 24, 2018 23:50
Copy link
Contributor

@rjmccall rjmccall 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
Copy link
Contributor

@swift-ci please smoke benchmark staging

@swift-ci
Copy link
Contributor

Build comment file:

Performance: -O

TEST OLD NEW DELTA SPEEDUP
Improvement
Prims 5543 894 -83.9% 6.20x
PrimsSplit 5498 907 -83.5% 6.06x

Performance: -Osize

TEST OLD NEW DELTA SPEEDUP
Improvement
PrimsSplit 5687 978 -82.8% 5.81x
Prims 5566 977 -82.4% 5.70x
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

@atrick atrick merged commit 523a1c7 into swiftlang:master Aug 25, 2018
@atrick atrick deleted the fix-tuple-assign branch October 16, 2018 16:23
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