WIP: hermetic (on the output side) loops.#36
Draft
eddyb wants to merge 1 commit intoeddyb/cfgssa-speedupsfrom
Draft
WIP: hermetic (on the output side) loops.#36eddyb wants to merge 1 commit intoeddyb/cfgssa-speedupsfrom
eddyb wants to merge 1 commit intoeddyb/cfgssa-speedupsfrom
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
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.
Note: this PR is a draft to avoid accidental merging onto its "base" branch (used as a form of ad-hoc PR stacking), and will remain as such, until its "base" branch can be set to
main, i.e. all prerequisite PRs will have landed, up to and including this PR (whose branch is the "base" of this one):NodeKind::Select(if-else/switch) already requires plumbing any values computed in a case, through that case's region outputs, so they can be accessed from the parent region (through the node's outputs).However, before this PR,
NodeKind::Loopoperated more like SSA dominance rules, and values defined by its body region, could be accessed outside of the loop.This PR changes loops to be similarly hermetic, and, similarly to RVSDG, plumb any values needed outside the loop, through the loop body's region outputs.
One example of where this change helps simplify/localize reasoning, is when replacing a node's outputs.
When all regions and nodes are ("output-side") hermetic, only the parent region of a node needs to be traversed, in order to find all uses of that node's outputs - and if they're being "exported" from the region, they will have to be used in the region's outputs, but only there will the original
Vars be used directly.TODO: improve pretty-printing, consider using
Option<Var>instead ofVarin region inputs/node outputs (in order to indicate a slot being taken up, but not actually actively used.