-
Notifications
You must be signed in to change notification settings - Fork 2.7k
JIT: streamline temp usage for returns #20640
JIT: streamline temp usage for returns #20640
Conversation
If the jit decides it needs a return spill temp, and the return value has already been spilled to a single-def temp, re-use the existing for the return temp rather than creating a new one. In conjunction with dotnet#20553 this allows late devirtualization for calls where the object in the virtual call is the result of an inline that provides a better type, and the objected formerly reached the call via one or more intermediate temps. Closes dotnet#15873.
This was originally needed for devirtualizing Diffs generally favorable; often better spill placement (one spill below a join instead of two spills above). The one big regression is in a method where inlining halts because of too many local vars. Since we've reduced temp usage somewhat we now do more inlines before we hit the limit.
cc @dotnet/jit-contrib |
Diff from the "late1" test case call CORINFO_HELP_NEWSFAST
mov rcx, rax
mov edx, 67
- mov rax, qword ptr [rax]
- mov rax, qword ptr [rax+64]
- call qword ptr [rax+32]B:F(int):int:this
+ call D:F(int):int:this
mov esi, eax
mov rcx, 0xD1FFAB1E
call CORINFO_HELP_NEWSFAST
mov rcx, rax
mov edx, 56
- mov rax, qword ptr [rax]
- mov rax, qword ptr [rax+64]
- call qword ptr [rax+32]B:F(int):int:this
+ call B:F(int):int:this
lea eax, [rsi+rax-100] |
Typical OSX CI failure:
|
Not sure the close of #15873 "[Local GC] FEATURE_EVENT_TRACE 1/n: Tracking Event State" is the right issue? |
Would it allow a second devirtualization (e.g. in dotnet/corefx#33085) |
@benaadams thanks -- that should have been #15783. Edited the PR header and will try and remember to edit the commit message too. |
If I understand the example correctly we would need late devirtualization to inspire more inlining. We're not able to do that today. |
Might not be very common (that's the only example that comes to mind atm) Further down the devirtualization line via interfaces might make it more of a thing; like passing a |
@dotnet/jit-contrib PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks Good
If the jit decides it needs a return spill temp, and the return value has already been spilled to a single-def temp, re-use the existing for the return temp rather than creating a new one. In conjunction with dotnet#20553 this allows late devirtualization for calls where the object in the virtual call is the result of an inline that provides a better type, and the objected formerly reached the call via one or more intermediate temps. Closes dotnet#15873.
If the jit decides it needs a return spill temp, and the return value has already been spilled to a single-def temp, re-use the existing for the return temp rather than creating a new one. In conjunction with dotnet#20553 this allows late devirtualization for calls where the object in the virtual call is the result of an inline that provides a better type, and the objected formerly reached the call via one or more intermediate temps. Closes dotnet#15873.
If the jit decides it needs a return spill temp, and the return value has already been spilled to a single-def temp, re-use the existing for the return temp rather than creating a new one. In conjunction with dotnet/coreclr#20553 this allows late devirtualization for calls where the object in the virtual call is the result of an inline that provides a better type, and the objected formerly reached the call via one or more intermediate temps. Closes dotnet/coreclr#15873. Commit migrated from dotnet/coreclr@ccc18a6
If the jit decides it needs a return spill temp, and the return value
has already been spilled to a single-def temp, re-use the existing
for the return temp rather than creating a new one.
In conjunction with #20553 this allows late devirtualization for calls where
the object in the virtual call is the result of an inline that provides
a better type, and the objected formerly reached the call via one or more
intermediate temps.
Closes #15783.