Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Address feedback, rename field
  • Loading branch information
jakobbotsch committed Jul 18, 2023
commit 5744580ebb5e12f60cc078f3b30e4b2442c7e251
9 changes: 5 additions & 4 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,11 @@ class LclVarDsc
unsigned char lvIsTemp : 1; // Short-lifetime compiler temp

#if FEATURE_IMPLICIT_BYREFS
unsigned char lvIsImplicitByRef : 1; // Set if the argument is an implicit byref.
unsigned char lvLastUseCopyOmissionCandidate : 1; // Set if the local appears as a last use that will be passed as
// an implicit byref.
#endif // FEATURE_IMPLICIT_BYREFS
// Set if the argument is an implicit byref.
unsigned char lvIsImplicitByRef : 1;
// Set if the local appears as a last use that will be passed as an implicit byref.
unsigned char lvIsLastUseCopyOmissionCandidate : 1;
#endif // FEATURE_IMPLICIT_BYREFS

#if defined(TARGET_LOONGARCH64)
unsigned char lvIs4Field1 : 1; // Set if the 1st field is int or float within struct for LA-ABI64.
Expand Down
15 changes: 10 additions & 5 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3993,7 +3993,7 @@ void Compiler::fgMakeOutgoingStructArgCopy(GenTreeCall* call, CallArg* arg)

if (!omitCopy && fgGlobalMorph)
{
omitCopy = (varDsc->lvLastUseCopyOmissionCandidate || (implicitByRefLcl != nullptr)) &&
omitCopy = (varDsc->lvIsLastUseCopyOmissionCandidate || (implicitByRefLcl != nullptr)) &&
!varDsc->lvPromoted && !varDsc->lvIsStructField && ((lcl->gtFlags & GTF_VAR_DEATH) != 0);
}

Expand Down Expand Up @@ -4643,7 +4643,7 @@ GenTree* Compiler::fgMorphLeafLocal(GenTreeLclVarCommon* lclNode)
// address.
if (varDsc->IsAddressExposed()
#if FEATURE_IMPLICIT_BYREFS
|| varDsc->lvLastUseCopyOmissionCandidate
|| varDsc->lvIsLastUseCopyOmissionCandidate
#endif
)
{
Expand Down Expand Up @@ -8391,7 +8391,12 @@ GenTree* Compiler::fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac, bool* optA
case GT_STORE_LCL_VAR:
case GT_STORE_LCL_FLD:
{
if (lvaGetDesc(tree->AsLclVarCommon())->IsAddressExposed())
LclVarDsc* lclDsc = lvaGetDesc(tree->AsLclVarCommon());
if (lclDsc->IsAddressExposed()
#if FEATURE_IMPLICIT_BYREFS
|| lclDsc->lvIsLastUseCopyOmissionCandidate
#endif
)
{
tree->AddAllEffectsFlags(GTF_GLOB_REF);
}
Expand Down Expand Up @@ -14773,7 +14778,7 @@ PhaseStatus Compiler::fgMarkImplicitByRefCopyOmissionCandidates()
unsigned lclNum = argNode->AsLclVarCommon()->GetLclNum();
LclVarDsc* varDsc = m_compiler->lvaGetDesc(lclNum);

if (varDsc->lvLastUseCopyOmissionCandidate)
if (varDsc->lvIsLastUseCopyOmissionCandidate)
{
// Already a candidate.
continue;
Expand Down Expand Up @@ -14809,7 +14814,7 @@ PhaseStatus Compiler::fgMarkImplicitByRefCopyOmissionCandidates()
}

JITDUMP("Marking V%02u as a candidate for last-use copy omission [%06u]\n", lclNum, dspTreeID(argNode));
varDsc->lvLastUseCopyOmissionCandidate = 1;
varDsc->lvIsLastUseCopyOmissionCandidate = 1;
}

return WALK_CONTINUE;
Expand Down