Use correct assignedInterval for SPILL_COST calculation #55247
Merged
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 #53853, I changed the
SPILL_COST
heuristic to also consider reload weight if the variable will be reloaded in future location rather than getting spilled at past location. However, while doing that, I incorrectly checking the wrong interval forisLocalVar
. I wanted to use similar condition as used inruntime/src/coreclr/jit/lsra.cpp
Line 3267 in d4b98b9
However, the interval I was using was that of the current refposition for which we are allocating the register rather than the interval to which the candidate register is already assigned.
Here is the sample diff of
Algorithms.VectorDoubleRenderer:RenderSingleThreadedWithADT(float,float,float,float,float)
that we can see: The high weight local variable gets assigned to the register.With better selection of register, we can now eliminate unnecessary spilling/resolution of expensive variables:
Some of the other regressions seen will be fixed by #54345.
Fixes: #54352