Repository navigation
Record value number equivalences from CSE - #136932
Draft
NinoFloris wants to merge 3 commits into
Draft
NinoFloris wants to merge 3 commits into
NinoFloris wants to merge 3 commits into
Conversation
|
Azure Pipelines: Successfully started running 5 pipeline(s). 10 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: @JulieLeeMSFT, @jakobbotsch |
NinoFloris
force-pushed
the
jit/cse-vn-equivalence-store
branch
2 times, most recently
from
November 4, 2026 04:05
afc8fe3 to
88d9031
Compare
CSE rewrites a use's conservative value number to its reaching definition's. Other nodes that carried the old value number, such as copies made before CSE, keep it, so facts created under one number are invisible under the other. Record the rewrite as a value number equivalence. The value number store keeps a union-find over rewritten numbers, empty for methods where no use changed. The representative is the number that says the most about the value: a constant, else a phi definition or a function, else the reaching definition's number; a constant never keys the map. Nothing consults it yet: the existing checked-bound transfer stays as it is, so this produces no code differences. A follow-up keys assertions by the representative.
About one method in nine records a rewrite, so the inline buckets of an embedded table would be carried by every value number store for nothing. Keep a pointer and allocate on the first record.
Most lookups are for numbers without a recorded equivalence, so a bit per number answers them without hashing, and the list behind it holds only the few pairs a method records, scanned in place. GrowableBitSet in bitvec.h is BitVec's shape without traits or a size up front, for a set whose index space is still being allocated while it fills.
NinoFloris
force-pushed
the
jit/cse-vn-equivalence-store
branch
from
November 5, 2026 00:30
88d9031 to
b92d0ab
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.
This is a zero-diff PR.
CSE rewrites a use's conservative value number to its reaching definition's, while nodes that carried the old number keep it.
InsertUseIntoSsaalready works around this for one fact, carrying checked-bound membership across the rewrite by hand. #136840 hit the same issue as null checks that survived a copy of the receiver. It recovered the identity by walking SSA copies at the lookup. Exact-type facts on a copied receiver and range facts on a captured bound lose track through CSE the same way.This PR begins to record the rewrite as an equivalence in the value number store: in a small union-find over rewritten numbers, empty for methods where no use changed, with the reaching definition's number as the 'representative' VN. Nothing consults it yet and the checked-bound transfer stays as it is. A follow-up keys assertions by the representative.
It is recorded exactly when CSE merges two loads into one. A reloaded heap field gets a fresh conservative number because nothing has decided yet that the loads can be one (
fgValueNumberTree, field loads). Only the one rewrite site (InsertUseIntoSsa) makes them equal, so facts never cross between loads that stayed separate.