Skip to content

Commit

Permalink
Delete "lvOverlappingFields" (#72356)
Browse files Browse the repository at this point in the history
We used to exclude locals with the flag set from SSA; this should no longer be necessary.
  • Loading branch information
SingleAccretion authored Aug 23, 2022
1 parent 2a2ebf9 commit be6399b
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 26 deletions.
7 changes: 3 additions & 4 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -530,10 +530,9 @@ class LclVarDsc
// 32-bit target. For implicit byref parameters, this gets hijacked between
// fgRetypeImplicitByRefArgs and fgMarkDemotedImplicitByRefArgs to indicate whether
// references to the arg are being rewritten as references to a promoted shadow local.
unsigned char lvIsStructField : 1; // Is this local var a field of a promoted struct local?
unsigned char lvOverlappingFields : 1; // True when we have a struct with possibly overlapping fields
unsigned char lvContainsHoles : 1; // True when we have a promoted struct that contains holes
unsigned char lvCustomLayout : 1; // True when this struct has "CustomLayout"
unsigned char lvIsStructField : 1; // Is this local var a field of a promoted struct local?
unsigned char lvContainsHoles : 1; // True when we have a promoted struct that contains holes
unsigned char lvCustomLayout : 1; // True when this struct has "CustomLayout"

unsigned char lvIsMultiRegArg : 1; // true if this is a multireg LclVar struct used in an argument context
unsigned char lvIsMultiRegRet : 1; // true if this is a multireg LclVar struct assigned from a multireg call
Expand Down
11 changes: 0 additions & 11 deletions src/coreclr/jit/lclvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1482,11 +1482,6 @@ void Compiler::lvaInitVarDsc(LclVarDsc* varDsc,
compFloatingPointUsed = true;
}

if (typeHnd != NO_CLASS_HANDLE)
{
varDsc->lvOverlappingFields = StructHasOverlappingFields(info.compCompHnd->getClassAttribs(typeHnd));
}

#if FEATURE_IMPLICIT_BYREFS
varDsc->lvIsImplicitByRef = 0;
#endif // FEATURE_IMPLICIT_BYREFS
Expand Down Expand Up @@ -3074,8 +3069,6 @@ void Compiler::lvaSetStruct(unsigned varNum, CORINFO_CLASS_HANDLE typeHnd, bool

unsigned classAttribs = info.compCompHnd->getClassAttribs(typeHnd);

varDsc->lvOverlappingFields = StructHasOverlappingFields(classAttribs);

// Check whether this local is an unsafe value type and requires GS cookie protection.
// GS checks require the stack to be re-ordered, which can't be done with EnC.
if (unsafeValueClsCheck && (classAttribs & CORINFO_FLG_UNSAFE_VALUECLASS) && !opts.compDbgEnC)
Expand Down Expand Up @@ -7930,10 +7923,6 @@ void Compiler::lvaDumpEntry(unsigned lclNum, FrameLayoutState curState, size_t r
if (varDsc->lvStructDoubleAlign)
printf(" double-align");
#endif // !TARGET_64BIT
if (varDsc->lvOverlappingFields)
{
printf(" overlapping-fields");
}

if (compGSReorderStackLayout && !varDsc->lvRegister)
{
Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16627,12 +16627,6 @@ PhaseStatus Compiler::fgRetypeImplicitByRefArgs()
// Since the parameter in this position is really a pointer, its type is TYP_BYREF.
varDsc->lvType = TYP_BYREF;

// Since this previously was a TYP_STRUCT and we have changed it to a TYP_BYREF
// make sure that the following flag is not set as these will force SSA to
// exclude tracking/enregistering these LclVars. (see SsaBuilder::IncludeInSsa)
//
varDsc->lvOverlappingFields = 0; // This flag could have been set, clear it.

// The struct parameter may have had its address taken, but the pointer parameter
// cannot -- any uses of the struct parameter's address are uses of the pointer
// parameter's value, and there's no way for the MSIL to reference the pointer
Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/jit/ssabuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1644,11 +1644,6 @@ bool SsaBuilder::IncludeInSsa(unsigned lclNum)
// lvPromoted structs are never tracked...
assert(!varDsc->lvPromoted);

if (varDsc->lvOverlappingFields)
{
return false; // Don't use SSA on structs that have overlapping fields
}

if (varDsc->lvIsStructField &&
(m_pCompiler->lvaGetParentPromotionType(lclNum) != Compiler::PROMOTION_TYPE_INDEPENDENT))
{
Expand Down

0 comments on commit be6399b

Please sign in to comment.