Skip to content

Commit

Permalink
JIT: reduce importer spilling for some stfld (dotnet#51158)
Browse files Browse the repository at this point in the history
If we know which local is going to be updated, just spill that local.
  • Loading branch information
AndyAyersMS authored Apr 14, 2021
1 parent 5f95440 commit 6d098da
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/coreclr/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15178,7 +15178,16 @@ void Compiler::impImportBlockCode(BasicBlock* block)
{
assert(tiObj);

if (impIsValueType(tiObj))
// If we can resolve the field to be within some local,
// then just spill that local.
//
GenTreeLclVarCommon* const lcl = obj->IsLocalAddrExpr();

if (lcl != nullptr)
{
impSpillLclRefs(lcl->GetLclNum());
}
else if (impIsValueType(tiObj))
{
impSpillEvalStack();
}
Expand Down

0 comments on commit 6d098da

Please sign in to comment.