Skip to content

Commit

Permalink
Deleting field sequences from LCL_FLD and VNF_PtrToArrElem (#68986)
Browse files Browse the repository at this point in the history
* Delete field sequences from GenTreeLclFld

* Delete field sequences from VNF_PtrToArrElem

* Clean up "DefinesLocalAddr"

Move the responsibility of determining "entireness" to
its only caller that needed to do that: "DefinesLocal".

Add function headers.

No diffs.

* Also clean up block morphing a little

No diffs.

* Fix a potential bug with return buffer numbering

Also address the TODO-CQ.

* Fix another "VN maintainance in morph" bug

Exposed by the more aggressive hoisting.
  • Loading branch information
SingleAccretion authored May 27, 2022
1 parent 7f7c6a2 commit f05fa01
Show file tree
Hide file tree
Showing 16 changed files with 278 additions and 946 deletions.
6 changes: 0 additions & 6 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,6 @@ class LclVarDsc
unsigned char lvInSsa : 1; // The variable is in SSA form (set by SsaBuilder)
unsigned char lvIsCSE : 1; // Indicates if this LclVar is a CSE variable.
unsigned char lvHasLdAddrOp : 1; // has ldloca or ldarga opcode on this local.
unsigned char lvStackByref : 1; // This is a compiler temporary of TYP_BYREF that is known to point into our local
// stack frame.

unsigned char lvHasILStoreOp : 1; // there is at least one STLOC or STARG on this local
unsigned char lvHasMultipleILStoreOp : 1; // there is more than one STLOC on this local
Expand Down Expand Up @@ -4782,8 +4780,6 @@ class Compiler
// Does value-numbering for a block assignment.
void fgValueNumberBlockAssignment(GenTree* tree);

bool fgValueNumberBlockAssignmentTypeCheck(LclVarDsc* dstVarDsc, FieldSeqNode* dstFldSeq, GenTree* src);

// Does value-numbering for a cast tree.
void fgValueNumberCastTree(GenTree* tree);

Expand Down Expand Up @@ -5702,8 +5698,6 @@ class Compiler
GenTree* fgMorphMultiOp(GenTreeMultiOp* multiOp);
GenTree* fgMorphConst(GenTree* tree);

bool fgMorphCanUseLclFldForCopy(unsigned lclNum1, unsigned lclNum2);

GenTreeLclVar* fgMorphTryFoldObjAsLclVar(GenTreeObj* obj, bool destroyNodes = true);
GenTreeOp* fgMorphCommutative(GenTreeOp* tree);
GenTree* fgMorphCastedBitwiseOp(GenTreeOp* tree);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ inline void GenTree::SetOper(genTreeOps oper, ValueNumberUpdate vnUpdate)
#endif
case GT_LCL_FLD:
AsLclFld()->SetLclOffs(0);
AsLclFld()->SetFieldSeq(FieldSeqStore::NotAField());
AsLclFld()->SetLayout(nullptr);
break;

case GT_CALL:
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/jit/decomposelongs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,9 @@ GenTree* DecomposeLongs::DecomposeLclVar(LIR::Use& use)
m_compiler->lvaSetVarDoNotEnregister(varNum DEBUGARG(DoNotEnregisterReason::LocalField));
loResult->SetOper(GT_LCL_FLD);
loResult->AsLclFld()->SetLclOffs(0);
loResult->AsLclFld()->SetFieldSeq(FieldSeqStore::NotAField());

hiResult->SetOper(GT_LCL_FLD);
hiResult->AsLclFld()->SetLclOffs(4);
hiResult->AsLclFld()->SetFieldSeq(FieldSeqStore::NotAField());
}

return FinalizeDecomposition(use, loResult, hiResult, hiResult);
Expand Down
7 changes: 0 additions & 7 deletions src/coreclr/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -961,13 +961,6 @@ bool Compiler::fgAddrCouldBeNull(GenTree* addr)
{
return false;
}

LclVarDsc* varDsc = lvaGetDesc(varNum);

if (varDsc->lvStackByref)
{
return false;
}
}
else if (addr->gtOper == GT_ADDR)
{
Expand Down
19 changes: 0 additions & 19 deletions src/coreclr/jit/gcinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,25 +346,6 @@ GCInfo::WriteBarrierForm GCInfo::gcWriteBarrierFormFromTargetAddress(GenTree* tg
return GCInfo::WBF_NoBarrier;
}

if (tgtAddr->OperGet() == GT_LCL_VAR)
{
unsigned lclNum = tgtAddr->AsLclVar()->GetLclNum();
LclVarDsc* varDsc = compiler->lvaGetDesc(lclNum);

// Instead of marking LclVar with 'lvStackByref',
// Consider decomposing the Value Number given to this LclVar to see if it was
// created using a GT_ADDR(GT_LCLVAR) or a GT_ADD( GT_ADDR(GT_LCLVAR), Constant)

// We may have an internal compiler temp created in fgMorphCopyBlock() that we know
// points at one of our stack local variables, it will have lvStackByref set to true.
//
if (varDsc->lvStackByref)
{
assert(varDsc->TypeGet() == TYP_BYREF);
return GCInfo::WBF_NoBarrier;
}
}

if (tgtAddr->TypeGet() == TYP_REF)
{
return GCInfo::WBF_BarrierUnchecked;
Expand Down
Loading

0 comments on commit f05fa01

Please sign in to comment.