Skip to content

Commit

Permalink
Set DNER for all local fields (#77341)
Browse files Browse the repository at this point in the history
Not just the promoted ones.
  • Loading branch information
SingleAccretion authored Oct 22, 2022
1 parent 4238ef0 commit 4e85471
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16386,10 +16386,6 @@ void Compiler::fgMorphLocalField(GenTree* tree, GenTree* parent)
}
else
{
// There is no existing field that has all the parts that we need
// So we must ensure that the struct lives in memory.
lvaSetVarDoNotEnregister(lclNum DEBUGARG(DoNotEnregisterReason::LocalField));

#ifdef DEBUG
// We can't convert this guy to a float because he really does have his
// address taken..
Expand All @@ -16405,6 +16401,12 @@ void Compiler::fgMorphLocalField(GenTree* tree, GenTree* parent)
JITDUMP("Replacing GT_LCL_FLD of struct with local var V%02u\n", lclNum);
}
}

// If we haven't replaced the field, make sure to set DNER on the local.
if (tree->OperIs(GT_LCL_FLD))
{
lvaSetVarDoNotEnregister(lclNum DEBUGARG(DoNotEnregisterReason::LocalField));
}
}

//------------------------------------------------------------------------
Expand Down

0 comments on commit 4e85471

Please sign in to comment.