Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Fix spill check for struct lclVars
Browse files Browse the repository at this point in the history
With the 1st class struct changes, the `SPILL_APPEND` check for the case of an assignment to a lclVar needs to handle block ops as well as lclVar lhs.

Fix #23545
  • Loading branch information
CarolEidt committed Mar 30, 2019
1 parent 192a53d commit e83fa97
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10624,11 +10624,22 @@ void Compiler::impImportBlockCode(BasicBlock* block)
SPILL_APPEND:

// We need to call impSpillLclRefs() for a struct type lclVar.
// This is done for non-block assignments in the handling of stloc.
if ((op1->OperGet() == GT_ASG) && varTypeIsStruct(op1->gtOp.gtOp1) &&
(op1->gtOp.gtOp1->gtOper == GT_LCL_VAR))
if ((op1->OperGet() == GT_ASG) && varTypeIsStruct(op1->gtGetOp1()))
{
impSpillLclRefs(op1->gtOp.gtOp1->AsLclVarCommon()->gtLclNum);
GenTree* lhs = op1->gtGetOp1();
GenTreeLclVarCommon* lclVar = nullptr;
if (lhs->gtOper == GT_LCL_VAR)
{
lclVar = lhs->AsLclVarCommon();
}
else if (lhs->OperIsBlk())
{
lclVar = lhs->AsBlk()->Addr()->IsLocalAddrExpr();
}
if (lclVar != nullptr)
{
impSpillLclRefs(lclVar->gtLclNum);
}
}

/* Append 'op1' to the list of statements */
Expand Down

0 comments on commit e83fa97

Please sign in to comment.