Skip to content

JIT: Handle return buffer definitions in TreeLifeUpdater #116137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jakobbotsch
Copy link
Member

Fix #116135

@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 30, 2025
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@jakobbotsch jakobbotsch marked this pull request as ready for review May 30, 2025 13:07
@Copilot Copilot AI review requested due to automatic review settings May 30, 2025 13:07
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses issue #116135 by handling return buffer definitions in TreeLifeUpdater.

  • Removed outdated TODO-Bug comment regarding handling calls with return buffers.
  • Added an else-if branch to obtain the return buffer local variable for call trees using gtCallGetDefinedRetBufLclAddr.
Comments suppressed due to low confidence (1)

src/coreclr/jit/treelifeupdater.cpp:307

  • Ensure that existing tests cover scenarios where call trees include return buffer definitions. Adding dedicated tests would validate the new behavior introduced in this branch.
else if (tree->IsCall())

@@ -305,6 +304,10 @@ void TreeLifeUpdater<ForCodeGen>::UpdateLife(GenTree* tree)
{
lclVarTree = tree->AsIndir()->Addr()->AsLclVarCommon();
}
else if (tree->IsCall())
{
lclVarTree = compiler->gtCallGetDefinedRetBufLclAddr(tree->AsCall());
Copy link
Preview

Copilot AI May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding a comment explaining the purpose and expected behavior of gtCallGetDefinedRetBufLclAddr, to improve maintainability.

Copilot uses AI. Check for mistakes.

@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @AndyAyersMS

Minor asm diffs.

Some large Windows TP regressions. Detailed TP diff is:

Base: 15998499578, Diff: 16018881868, +0.1274%

63407795  : +6026.77% : 59.51% : +0.3963% : protected: void __cdecl CodeGenInterface::genUpdateLife(struct GenTree *)                                                  
-322342   : -2.68%    : 0.30%  : -0.0020% : private: void __cdecl emitter::emitInsLoadInd(enum instruction, enum emitAttr, enum _regNumber_enum, struct GenTreeIndir *)
-3453744  : -11.80%   : 3.24%  : -0.0216% : protected: void __cdecl CodeGen::genCodeForStoreLclVar(struct GenTreeLclVar *)                                             
-18334466 : -9.11%    : 17.21% : -0.1146% : protected: enum _regNumber_enum __cdecl CodeGen::genConsumeReg(struct GenTree *)                                           
-20884892 : -16.25%   : 19.60% : -0.1305% : protected: void __cdecl CodeGen::genProduceReg(struct GenTree *)                                                           

Appears to be because of different inlining decisions, so will leave that up to native PGO. linux-x64 TP diffs also do not show significant impact.

@jakobbotsch jakobbotsch requested a review from AndyAyersMS May 30, 2025 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JIT: Struct value defined via retbuf is not saved in continuation even though it is live
2 participants