Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
4 changes: 1 addition & 3 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -4091,8 +4091,6 @@ class Compiler
unsigned lvaInlineeReturnSpillTemp = BAD_VAR_NUM; // The temp to spill the non-VOID return expression
// in case there are multiple BBJ_RETURN blocks in the inlinee
// or if the inlinee has GC ref locals.

bool lvaInlineeReturnSpillTempFreshlyCreated = false; // True if the temp was freshly created for the inlinee return

#if FEATURE_FIXED_OUT_ARGS
unsigned lvaOutgoingArgSpaceVar = BAD_VAR_NUM; // var that represents outgoing argument space
Expand Down Expand Up @@ -4357,7 +4355,7 @@ class Compiler
// If the local is TYP_REF, set or update the associated class information.
void lvaSetClass(unsigned varNum, CORINFO_CLASS_HANDLE clsHnd, bool isExact = false);
void lvaSetClass(unsigned varNum, GenTree* tree, CORINFO_CLASS_HANDLE stackHandle = nullptr);
void lvaUpdateClass(unsigned varNum, CORINFO_CLASS_HANDLE clsHnd, bool isExact = false, bool singleDefOnly = true);
void lvaUpdateClass(unsigned varNum, CORINFO_CLASS_HANDLE clsHnd, bool isExact = false);
void lvaUpdateClass(unsigned varNum, GenTree* tree, CORINFO_CLASS_HANDLE stackHandle = nullptr);

#define MAX_NumOfFieldsInPromotableStruct 4 // Maximum number of fields in promotable struct
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/jit/fgbasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3562,8 +3562,6 @@ void Compiler::fgFindBasicBlocks()
lvaSetClass(lvaInlineeReturnSpillTemp, retClassHnd);
}
}

lvaInlineeReturnSpillTempFreshlyCreated = true;
}
}

Expand Down
8 changes: 3 additions & 5 deletions src/coreclr/jit/fgopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,19 +309,17 @@ PhaseStatus Compiler::fgPostImportationCleanup()
{
// Update type of return spill temp if we have gathered
// better info when importing the inlinee, and the return
// spill temp is single def or was freshly created for this inlinee
// spill temp is single def.
if (fgNeedReturnSpillTemp())
{
CORINFO_CLASS_HANDLE retExprClassHnd = impInlineInfo->retExprClassHnd;
if (retExprClassHnd != nullptr)
{
LclVarDsc* returnSpillVarDsc = lvaGetDesc(lvaInlineeReturnSpillTemp);

if (returnSpillVarDsc->lvType == TYP_REF &&
(returnSpillVarDsc->lvSingleDef || lvaInlineeReturnSpillTempFreshlyCreated))
if ((returnSpillVarDsc->lvType == TYP_REF) && returnSpillVarDsc->lvSingleDef)
{
lvaUpdateClass(lvaInlineeReturnSpillTemp, retExprClassHnd, impInlineInfo->retExprClassHndIsExact,
false);
lvaUpdateClass(lvaInlineeReturnSpillTemp, retExprClassHnd, impInlineInfo->retExprClassHndIsExact);
}
}
}
Expand Down
20 changes: 6 additions & 14 deletions src/coreclr/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11076,21 +11076,13 @@ bool Compiler::impReturnInstruction(int prefixFlags, OPCODE& opcode)
impInlineInfo->retExprClassHnd = returnClsHnd;
impInlineInfo->retExprClassHndIsExact = isExact;
}
else
else if (impInlineInfo->retExprClassHnd != returnClsHnd)
{
if (impInlineInfo->retExprClassHnd != returnClsHnd)
{
// This return site type differs from earlier seen sites,
// so reset the info and we'll fall back to using the method's
// declared return type for the return spill temp.
impInlineInfo->retExprClassHnd = nullptr;
impInlineInfo->retExprClassHndIsExact = false;
}
else
{
// Same return type, but we may need to update exactness.
impInlineInfo->retExprClassHndIsExact &= isExact;
}
// This return site type differs from earlier seen sites,
// so reset the info and we'll fall back to using the method's
// declared return type for the return spill temp.
impInlineInfo->retExprClassHnd = nullptr;
impInlineInfo->retExprClassHndIsExact = false;
}
}

Expand Down
13 changes: 4 additions & 9 deletions src/coreclr/jit/lclvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3601,7 +3601,6 @@ void Compiler::lvaSetClass(unsigned varNum, GenTree* tree, CORINFO_CLASS_HANDLE
// varNum -- number of the variable
// clsHnd -- class handle to use in set or update
// isExact -- true if class is known exactly
// singleDefOnly -- true if we should only update single-def locals
//
// Notes:
//
Expand All @@ -3619,7 +3618,7 @@ void Compiler::lvaSetClass(unsigned varNum, GenTree* tree, CORINFO_CLASS_HANDLE
// for shared code, so ensuring this is so is currently not
// possible.

void Compiler::lvaUpdateClass(unsigned varNum, CORINFO_CLASS_HANDLE clsHnd, bool isExact, bool singleDefOnly)
void Compiler::lvaUpdateClass(unsigned varNum, CORINFO_CLASS_HANDLE clsHnd, bool isExact)
{
assert(varNum < lvaCount);

Expand All @@ -3632,12 +3631,8 @@ void Compiler::lvaUpdateClass(unsigned varNum, CORINFO_CLASS_HANDLE clsHnd, bool
// We should already have a class
assert(varDsc->lvClassHnd != NO_CLASS_HANDLE);

// We should only be updating classes for single-def locals if requested
if (singleDefOnly && !varDsc->lvSingleDef)
{
assert(!"Updating class for multi-def local");
return;
}
// We should only be updating classes for single-def locals.
assert(varDsc->lvSingleDef);

// Now see if we should update.
//
Expand Down Expand Up @@ -3684,7 +3679,7 @@ void Compiler::lvaUpdateClass(unsigned varNum, CORINFO_CLASS_HANDLE clsHnd, bool
}

//------------------------------------------------------------------------
// lvaUpdateClass: Update class information for a local var from a tree
// lvaUpdateClass: Uupdate class information for a local var from a tree
// or stack type
//
// Arguments:
Expand Down
Loading