-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Cleanup/fix AccessEnforcementOpts #23190
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
Conversation
@swift-ci test. |
@swift-ci test source compatibility. |
@swift-ci benchmark. |
Build failed |
Build failed |
Performance: -O
Code size: -O
Performance: -Osize
Code size: -Osize
How to read the dataThe 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 Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
Most of the API's operate on the data flow state (RegionState) with respect to the information for a given access (AccessInfo). Calling them both "info" made the code completely indecipherable.
And remove cubic behavior.
The previous design was customized to perfoming IPO with GenericSideEffectAnalysis. Expose the underlying logic as a utility so that AccessEnforcementOpts can use it to summarize loops (in addition to call sites).
AccessSummary was storing unnecessary state in every per-block entry in the global map. It was also making most of the code in this pass very hard to read. Rewriting mergePredAccesses allows AccessSummary to be removed. The new implementation also avoids unnecessary DenseMap lookups. There is also a functional change. mergePredAccesses was clearing the state of predecessor blocks. This isn't logical and had no explanation.
The optimization already proves that there are no potential conflicts between the two merged scopes, so merging them can't introduce a new nested conflict.
Directly implement the data flow. Eliminate the extraneous work. Remove cubic behavior. Do a single iteration of the data flow state at each program point only performing the necessary set operations. At unidentified access, clear the sets for simplicity and efficiency. This cleanup results in significant functional changes: - Allowing scopes to merge even if they are enclosed. - Handling unidentified access conservatively. Note that most of the added lines of code are comments. Somehow this cleanup incidentally fixes: <rdar://problem/48514339> swift compiler hangs building project (I expected the subsequent loop summary cleanup to fix that problem.)
Reuse AccessStorageAnalysis to summarize accesses. Don't ignore call sites in loops. Don't consider a read access in a loop to conflict with a read outside. Use the unidentified access flag from the analysis. Remove extraneous code, some of which was unreachable. General cleanup.
@swift-ci test. |
@swift-ci test source compatibility. |
Build failed |
Build failed |
@swift-ci test linux platform. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Merge pull request #23190 from atrick/cleanup-accessopts
Simplify the analysis and dataflow to make the pass faster eliminate bugs as a side effect.
This is broken into a series of commits. The commit called "Redo the data flow" can't be reviewed as a diff. It's best just to read the new code, referencing the old code if it's helpful.
I'm posting this somewhat prematurely (I haven't done self-review or looked into adding more tests) so there is plenty of time for review. I don't plan on checking in until a week from now.