JIT: Model GT_RETURN kills with contained operand #111230
Draft
+10
−0
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.
When
GT_RETURN
has a contained operand (due to returning a DNER local), it will load the ABI return registers directly from stack. This will kill those registers. However, nothing was modelling this kill.This was noticed while trying to ensure that GC information is correctly marked in codegen when going into epilogs (#107283). However, this is potential bad codegen even on its own: before this change LSRA might not properly spill locals that are required to be live around a
GT_RETURN
node even if they are getting killed by theGT_RETURN
. A concrete case was seen in<StartupCode$FSharp-Core>.$Tasks+Using@148-5[System.__Canon]:Invoke
under JitStressRegs=2, where the VM requests that the JIT keep "this" alive throughout the function. Before this change we get the following codegen:where "this" is in
x1
going into the block, and gets overridden by the return without being available somewhere else. After this change, the codegen becomes