Migrate analyzer local state to a structured value lattice - #134468
Draft
jtschuster wants to merge 1 commit into
Draft
jtschuster wants to merge 1 commit into
jtschuster wants to merge 1 commit into
Conversation
jtschuster
added this pull request to stack #134470
September 22, 2026 22:14
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @agocke, @dotnet/illink |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
jtschuster
force-pushed
the
tuple-localvalue-lattice
branch
from
September 22, 2026 23:21
cae2018 to
ab62d25
Compare
This branch has not been deployed
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.
Summary
In the analyzer, we see
ITupleOperations that could be lowered to ValueTuple construction and destruction, or lowered to assignments to local variables -- but there is no way to know for sure. However, the basic (and relatively common) case of(a, b) = (b, a)should be supported. This requires us to model a Tuple value in dataflow. In the current implementation, we can model it in Deconstruction evaluation, but it's not a first-class concept in the dataflow visitor. This PR stack makes the concept of a Tuple of TValue a first-class concept.ITupleOperations are treated as Top in the lattice for all cases except for when it is the outer operation on a DeconstructionOperation (i.e. an expression in the form of(a, b) = (b, a)). If the TupleOperation appears elsewhere in the deconstruction (for example, within a ternary that is deconstructed(a, b) = c ? (x, y) : (b, a)), we make no assumption about whether or not a ValueTuple is created.This PR introduces a recursive LocalValue and its lattice for local state, r-value captures, and hoisted state, while preserving existing deconstruction behavior. This LocalValue implements the first-class support for Tuples of TValue in the dataflow visitor. Also adds equality, deep-copy, and lattice-law tests.
Validation
Stack layer 2/3, based on the tests-only branch.
Note
This PR was generated with GitHub Copilot assistance.
Stack created with GitHub Stacks CLI • Give Feedback 💬