-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add swift SIL/Optimizer infrastructure #40805
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
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
@swift-ci smoke test |
1 similar comment
@swift-ci smoke test |
* instructions: function_ref, mark_dependence * add `BuiltinInst.id` * add isObjC and canAllocOnStack for alloc_ref and alloc_ref_dynamic * add `ApplySite::referencedFunction` * add `Builder.createDeallocStackRef` * add == and != operators for `Function` * add `List.first` and `ReverseList.first`
Improve block/instruction lists and similar collections * pretty print collections in the form “[a, b, c]” * also do this for lazy sequences * define a custom Mirror * in a collection, only print the name of blocks, functions and globals (instead of the full object) * replace `BasicBlock.reverseInstructions` with `BasicBlock.instructions.reversed()` - in an efficient way
…ackList * add `BasicBlockSet` * add `BasicBlockWorklist` * add `BasicBlockRange`, which defines a range of blocks from a common dominating “begin” block to a set of “end” blocks. * add `InstructionRange`, which is similar to `BasicBlockRange`, just on instruction level. It can be used for value lifetime analysis. * rename `StackList` -> `Stack` and move it to `Optimizer/DataStructures` * rename `PassContext.passContext` to `PassContext._bridged` * add notify-functions to PassContext
This bridges to the StackNesting utility in C++
…lity For inserting new instruction after another instruction. This is especially interesting if the insertion point is a terminator. In this case, the new instruction(s) are inserted in the successor block(s).
a0d2d11
to
82ad1fa
Compare
@swift-ci smoke test |
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.
All this are generally useful additions. The motivation to add them now is because they will be needed by #39438.
The main changes are:
BasicBlockSet
,BasicBlockWorklist
,BasicBlockRange
InstructionRange
which can be used for value lifetime analysis.For details see the commit messages.
InstructionRange
(which builds on top ofBasicBlockRange
) is doing backward reachability analysis e.g. to compute the life range of a value. For reference: on the C++ side we have four different utilities for this purpose, which all do approximately the same thing:ValueLifetimeAnalysis
,findJointPostDominatingSet
,PrunedLiveness
andBackwardReachability
(We should avoid piling up redundant utilities). Instruction/BasicBlockRange is the utility for this purpose on the swift side.This PR does not contain tests for the new utilities, because they will be tested by the larger #39438.