Skip to content
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

JIT: Update type when return temp is freshly created #111948

Merged
merged 18 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/coreclr/jit/fgbasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3562,6 +3562,8 @@ void Compiler::fgFindBasicBlocks()
lvaSetClass(lvaInlineeReturnSpillTemp, retClassHnd);
}
}

impInlineInfo->inlineCandidateInfo->preexistingSpillTemp = lvaInlineeReturnSpillTemp;
hez2010 marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
18 changes: 16 additions & 2 deletions src/coreclr/jit/fgopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,23 @@ PhaseStatus Compiler::fgPostImportationCleanup()
{
LclVarDsc* returnSpillVarDsc = lvaGetDesc(lvaInlineeReturnSpillTemp);

if ((returnSpillVarDsc->lvType == TYP_REF) && returnSpillVarDsc->lvSingleDef)
if ((returnSpillVarDsc->lvType == TYP_REF))
{
lvaUpdateClass(lvaInlineeReturnSpillTemp, retExprClassHnd, impInlineInfo->retExprClassHndIsExact);
if (returnSpillVarDsc->lvSingleDef)
{
lvaUpdateClass(lvaInlineeReturnSpillTemp, retExprClassHnd,
impInlineInfo->retExprClassHndIsExact);
}
else if (lookupNamedIntrinsic(info.compMethodHnd) == NI_System_SZArrayHelper_GetEnumerator)
{
// If we are inlining System.SZArrayHelper.GetEnumerator, update the type of the return spill
// temp regardless of whether it is single def or not.
returnSpillVarDsc->lvClassHnd = retExprClassHnd;
returnSpillVarDsc->lvClassIsExact = impInlineInfo->retExprClassHndIsExact;
#if DEBUG
returnSpillVarDsc->lvClassInfoUpdated = true;
#endif
}
hez2010 marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Expand Down
Loading