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 |
Open
3 tasks
This was referenced Nov 18, 2026
Sum the weighted costs and size savings of the expressions replaced at use sites. Allow a rounding-sized difference when comparing break-even costs.
When the sole use stores the result into an enregisterable local, the local and the CSE temp can share a register. Charge one unit for the read in speed-oriented code without a call crossing.
Use SSA to find a single-register input consumed by every occurrence. Re-entering the defining occurrence must produce a fresh input. Apply the existing use discount once when its register can hold the result.
NinoFloris
force-pushed
the
jit/cse-use-costs
branch
from
November 29, 2026 16:05
07af3ec to
991be25
Compare
NinoFloris
marked this pull request as ready for review
November 29, 2026 17:46
NinoFloris
force-pushed
the
jit/cse-use-costs
branch
from
November 29, 2026 18:09
e5f0055 to
971b838
Compare
Discount the cost of capturing a multi-instruction constant that already needs a register. Exclude hoisted definitions and cap the credit at the weighted uses remaining after the first use per definition.
This was referenced Nov 30, 2026
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.
Preferred order (regression mitigation): #137513 -> #137826 -> #137835.
Today the JIT uses the first occurrence of a CSE candidate to estimate what it saves at every use. Two expressions can have the same value number and still cost different amounts to compute. This PR prices the expressions each use actually replaces and accounts for cases where the definition or a use can reuse a register.
Commits:
On ARM64, an integer load puts its result in a register before a compare or arithmetic instruction can use it. On x64 the instruction can read memory directly, so the same discount can underestimate the cost of keeping the value. ARM64 is where I’ve measured the benefit.
GT_COMMAwhen identifying the value a store consumes, so a preceding bounds check still allows the definition discount.On ARM64, materializing a counter address can take a
movzand twomovks. Keeping the base lets later counter accesses use a singleadd. On x64 the full address fits in onemov, and applying the discount to eligible handles grew code on both Linux and Windows.