Skip to content
Closed
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
21 changes: 20 additions & 1 deletion src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12985,6 +12985,26 @@ GenTree* Compiler::fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac)
}
break;

case GT_RETURN:
{
// Force dependent promotion for promoted locals which we'll use indirectly.
// Only needed for "TYP_STRUCT" because we expect the "IND(ADDR(LCL))" logic
// to transform primitives into "LCL_FLD"s (marking the local DNER).
// TODO-ADDR: support "TYP_STRUCT" "LCL_FLD"s, always convert such indirs to
// them in "LocalAddressVisitor", and have this code morph the local field
// into the promoted field local.
GenTreeLclVarCommon* lclNode = nullptr;
bool isEntire = false;
if ((op1 != nullptr) && op1->TypeIs(TYP_STRUCT) && op1->OperIsIndir() &&
op1->AsIndir()->Addr()->DefinesLocalAddr(this, 0, &lclNode, &isEntire) &&
lvaGetDesc(lclNode)->lvPromoted)
{
assert(!lvaIsImplicitByRefLocal(lclNode->GetLclNum()));
lvaSetVarDoNotEnregister(lclNode->GetLclNum() DEBUGARG(DoNotEnregisterReason::BlockOpRet));
}
}
break;

case GT_COLON:
if (fgGlobalMorph)
{
Expand Down Expand Up @@ -14346,7 +14366,6 @@ GenTree* Compiler::fgMorphRetInd(GenTreeUnOp* ret)

unsigned lclVarSize;
if (!lclVar->TypeIs(TYP_STRUCT))

{
lclVarSize = genTypeSize(varDsc->TypeGet());
}
Expand Down