SSA CFG populate spill set in target size heuristic#16599
Open
SSA CFG populate spill set in target size heuristic#16599
Conversation
ec931b8 to
96ce5c5
Compare
clonker
commented
Apr 16, 2026
Comment on lines
+39
to
+41
| // (target)| v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 v18 v19 v20 | | ||
| // Status: MaxIterationsReached | ||
| // Spilled: {v1, v2, v4, v20} |
…on a dynamic spill set
- allNecessarySlotsReachableOrFinal takes spill set into account - target min counts / required in tail checks exclude spilled variables
96ce5c5 to
4d4f87d
Compare
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.
In a next step, the heuristic should get the currently existing spill set as initial state.
SpilledVariablestype (map ofSSACFG::ValueId→ slot) and thread it through the SSA stack abstraction viaStack::setSpilledVariables/spilledVariables().Stack::canBeFreelyGeneratedbecomes non-static and treats spilled values as freely materializable alongside literals, junk, and call return labelsStackShufflerto honor the spill setTargetconstructor accepts the spill set and excludes spilled values fromminCountand theliveOuttail countrequiredInTailreturns false for spilled values (rematerializable)findOptimalTargetSizenow iteratively retriesshuffle, adding theStackTooDeepculprit to a local spill set each round; cost function penalizes spills with+1000per spilled variableStackShufflerTestwithallowSpilling/initialSpilledSetparser keys, a pre-pass to compute the spill set, reporting of spilled values in the trace, and tail-set assertions that skip spilled IDsdepends a little bit on #16598 to deal with some emerging cycles. could theoretically also be stand-alone.