Skip to content

EscapeAnalysis verification: fix false positives. #29316

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 6 commits into from
Jan 23, 2020
Merged

EscapeAnalysis verification: fix false positives. #29316

merged 6 commits into from
Jan 23, 2020

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Jan 20, 2020

This is a collection of EscapeAnalysis commits related to verification. It fixes some false positives while making the analysis results a bit more precise and consistent.

They are easier to review independently, but easier to push through as one PR. An open bug is waiting on the last commit in the series.

Fixes rdar://58445744 swiftc assert during EscapeAnalysis verification: (EA->isPointer(Nd->mappedValue)), function verify

When ConnectionGraph merging triggers an assert, report which
functions are being merged.
@atrick atrick requested a review from eeckstein January 20, 2020 07:24
@atrick
Copy link
Contributor Author

atrick commented Jan 20, 2020

@swift-ci test

@atrick
Copy link
Contributor Author

atrick commented Jan 20, 2020

@swift-ci test source compatibility

@atrick
Copy link
Contributor Author

atrick commented Jan 20, 2020

@swift-ci benchmark

@swift-ci
Copy link
Contributor

Performance: -O

Code size: -O

Performance: -Osize

Code size: -Osize

Performance: -Onone

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeStubFromNSStringRef 124 135 +8.9% 0.92x (?)
ObjectiveCBridgeStubFromNSString 470 506 +7.7% 0.93x (?)
 
Improvement OLD NEW DELTA RATIO
StringToDataEmpty 650 600 -7.7% 1.08x (?)

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

Don't merge node properties until after node merging begins, so
internal verification can run right before each merge.

Rework ConnectionGraph::mergeFrom. Remove an extra loop. Defer
mergeAllScheduledNodes until all the source graph's mapped nodes are
added so that the graph is always structurally valid before a
merge. This is also necessary to avoid EscapeAnalysis
assert: (!To->mergeTo), in setPointsToEdge.

Enable -escapes-internal-verify to all tests in escape_analysis.sil.

Add hand-reduced unit tests in escape_analysis_reduced.sil.
Noticed by code inspection during debugging. This avoids some work but
is probably NFC.
Noticed by code inspection during debugging.

Iterator invalidaton could occur because two types of edges, which are
handled independently, actually share the same phyical list.

Fix the visitor utility that iterates over defer edges to be robust
for visitors that change the pointsTo edge. Use a temporary vector to
be safe.
Defer edges should always point to the more specific SSA value. For
example, the contents of a memory location point to the values stored
in that locations. Tuples point to their elements. BBArgs point to
their source operands. Likewise, array objects should point to their
exposed unsafe pointer (which is effectively a value stored in the
array object). I'm not sure why the defer edges were reversed in the
first place, but it was always confusing me.
Consistently handle base and derived pointers.

Consistently avoid creating nodes for undef, which breaks
verification.

Be more precise about creating the node based on the derived pointer
type.

Remove a few extraneous helpers.

Fixes <rdar://58445744> swiftc assert during EscapeAnalysis
verification: (EA->isPointer(Nd->mappedValue)), function verify
@atrick
Copy link
Contributor Author

atrick commented Jan 22, 2020

@swift-ci test

@atrick
Copy link
Contributor Author

atrick commented Jan 22, 2020

@swift-ci test source compatibility

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - fba743b227cf8000259e1df618949b45793b4f1d

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - fba743b227cf8000259e1df618949b45793b4f1d

@atrick atrick merged commit 82a9f13 into swiftlang:master Jan 23, 2020
@atrick atrick deleted the escape-verifysummary branch January 23, 2020 18:25
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.

2 participants