-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add stronger SILVerifier support for formal access. #16880
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This information was getting lost in SIL printing/parsing. Some passes rely on it. Regardless of whether passes should rely on it, it is totally unacceptable for the SIL passes to have subtle differences in behavior depending on the frontend mode. So, if we don't want passes to rely on global variable decls, that needs to be enforced by the API independent of how the frontend is invoked or how SIL is serialized.
Move the utilities that are required for recognizing SILGlobalVariable access into SILGlobalVariable.[h|cpp]. Structural SIL properties that are assumed by the optimizer, and thus required for SIL verification, should never be embedded in SILOptimizer passes, or even in SILOptimizer/Utils. Structural SIL properties need to be defined in /SIL. They are as much part of the SIL language as the opcode list. These particular utilities are required for working with SILGlobalVariables, and will be used by a whole-module access enforcement optimization. The primary API for recognizing SIL globals is `getVariableOfGlobalInit`. It is required to find the association between the addressor SILFunction marked [global_init], and the SILGlobalVariable being addressed. Other helper APIs expose more details about the addressor's SIL patterns and are useful for transforming the initializer itself into an optimized form.
@swift-ci test. |
@swift-ci test source compatibility. |
Build failed |
+1! Static verification FTW! |
AccessedStorage now properly represents access to global variables, even if they haven't been fully optimized down to global_addr instructions. This is essential for optimizing dynamic exclusivity checks. As a verified SIL property, all access to globals and class properties needs to be identifiable.
Ensure that all formal access follows recognizable patterns at all points in the SIL pipeline. This is important to run acccess enforcement optimization late in the pipeline.
@swift-ci test source compatibility. |
This PR can't be merged until I handle all the access patterns that show up in debug builds. |
Closing and folding the change into #16877. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ensure that all formal access follows recognizable patterns
at all points in the SIL pipeline.
This is important to run acccess enforcement optimization late in the pipeline.
This is a single-commit PR building on #16877