diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index 139d204638b9f..e3e437e81e5a7 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -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(); }