Skip to content

Fix EscapeAnalysis losing precision during merge. #29249

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
Jan 17, 2020
Merged

Fix EscapeAnalysis losing precision during merge. #29249

merged 1 commit into from
Jan 17, 2020

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Jan 16, 2020

Array storage was being stack promoted even though it escaped. This
happened because multiple locally allocated arrays were merged into
the same locally allocated array value box. For this to become a
problem, other bizarre merge events need to take place, such as a
value node being mapped with a content node. The series of events led
to a missing edge in the connection graph. One of the arrays was
mapped directly to a project_box instruction which had forgotten it's
relationship with the alloc_box.

It is a trivial one line fix to simply preserve all value mappings.

Fixes rdar://58371330 app crashes (miscompile)

@atrick atrick requested a review from eeckstein January 16, 2020 11:03
@atrick
Copy link
Contributor Author

atrick commented Jan 16, 2020

@swift-ci test

@atrick
Copy link
Contributor Author

atrick commented Jan 16, 2020

@swift-ci test source compatibility

@atrick
Copy link
Contributor Author

atrick commented Jan 16, 2020

@swift-ci benchmark

@swift-ci
Copy link
Contributor

Performance: -O

Regression OLD NEW DELTA RATIO
SuffixArrayLazy 4 9 +125.0% 0.44x
 
Improvement OLD NEW DELTA RATIO
ObjectiveCBridgeStubFromNSStringRef 100 93 -7.0% 1.08x (?)
UTF8Decode_InitDecoding_ascii 192 179 -6.8% 1.07x (?)
PrefixAnySeqCRangeIterLazy 15 14 -6.7% 1.07x (?)

Code size: -O

Performance: -Osize

Regression OLD NEW DELTA RATIO
MapReduceShortString 13 14 +7.7% 0.93x (?)
 
Improvement OLD NEW DELTA RATIO
PrefixWhileCountableRange 18 16 -11.1% 1.12x (?)
FlattenListLoop 3284 2924 -11.0% 1.12x (?)
DropWhileSequence 14 13 -7.1% 1.08x (?)

Code size: -Osize

Performance: -Onone

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 mini
  Model Identifier: Macmini8,1
  Processor Name: 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

Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

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

lgtm

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 2d06504c4f30a71c9bb2c98900d9d663b3286d4b

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 2d06504c4f30a71c9bb2c98900d9d663b3286d4b

Array storage was being stack promoted even though it escaped. This
happened because multiple locally allocated arrays were merged into
the same locally allocated array value box. For this to become a
problem, other bizarre merge events need to take place, such as a
value node being mapped with a content node. The series of events led
to a missing edge in the connection graph. One of the arrays was
mapped directly to a project_box instruction which had forgotten it's
relationship with the alloc_box.

It is a trivial one line fix to simply preserve all value mappings.

<rdar://58371330> app crashes (miscompile)
@atrick
Copy link
Contributor Author

atrick commented Jan 17, 2020

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 2d06504c4f30a71c9bb2c98900d9d663b3286d4b

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 2d06504c4f30a71c9bb2c98900d9d663b3286d4b

@atrick atrick merged commit c3a08f0 into swiftlang:master Jan 17, 2020
@atrick atrick deleted the fix-stackpromote branch January 17, 2020 20:59
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