Skip to content

Commit 189b03c

Browse files
Fix a couple issues with GTF_GLOB_REF setting
Add it to INDs and BLKs off of exposed ADDRs in addition to OBJs. Remove code from args morphing which was re-deriving the side effects flags for an OBJ argument, it was: a) Unnecessary, as morph has already done all the work. b) Incorrect, as it lost GTF_GLOB_REF for OBJ(ADDR(LCL (AX)))-like trees.
1 parent 95f7f7a commit 189b03c

1 file changed

Lines changed: 13 additions & 16 deletions

File tree

src/coreclr/jit/morph.cpp

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4917,12 +4917,6 @@ void Compiler::fgMakeOutgoingStructArgCopy(GenTreeCall* call, GenTreeCall::Use*
49174917
GenTree* dest = gtNewLclvNode(tmp, lvaTable[tmp].lvType);
49184918
dest->gtFlags |= (GTF_DONT_CSE | GTF_VAR_DEF); // This is a def of the local, "entire" by construction.
49194919

4920-
if (argx->gtOper == GT_OBJ)
4921-
{
4922-
argx->gtFlags &= ~(GTF_ALL_EFFECT) | (argx->AsBlk()->Addr()->gtFlags & GTF_ALL_EFFECT);
4923-
argx->SetIndirExceptionFlags(this);
4924-
}
4925-
49264920
// Copy the valuetype to the temp
49274921
GenTree* copyBlk = gtNewBlkOpNode(dest, argx, false /* not volatile */, true /* copyBlock */);
49284922
copyBlk = fgMorphCopyBlock(copyBlk);
@@ -12419,19 +12413,22 @@ GenTree* Compiler::fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac)
1241912413
break;
1242012414

1242112415
case GT_OBJ:
12422-
// If we have GT_OBJ(GT_ADDR(X)) and X has GTF_GLOB_REF, we must set GTF_GLOB_REF on
12423-
// the GT_OBJ. Note that the GTF_GLOB_REF will have been cleared on ADDR(X) where X
12424-
// is a local or clsVar, even if it has been address-exposed.
12425-
if (op1->OperGet() == GT_ADDR)
12416+
case GT_BLK:
12417+
case GT_IND:
12418+
{
12419+
// If we have IND(ADDR(X)) and X has GTF_GLOB_REF, we must set GTF_GLOB_REF on
12420+
// the OBJ. Note that the GTF_GLOB_REF will have been cleared on ADDR(X) where X
12421+
// is a local or CLS_VAR, even if it has been address-exposed.
12422+
if (op1->OperIs(GT_ADDR))
1242612423
{
12427-
GenTreeUnOp* addr = op1->AsUnOp();
12428-
GenTree* addrOp = addr->gtGetOp1();
12429-
tree->gtFlags |= (addrOp->gtFlags & GTF_GLOB_REF);
12424+
tree->gtFlags |= (op1->AsUnOp()->gtGetOp1()->gtFlags & GTF_GLOB_REF);
12425+
}
12426+
12427+
if (!tree->OperIs(GT_IND))
12428+
{
12429+
break;
1243012430
}
12431-
break;
1243212431

12433-
case GT_IND:
12434-
{
1243512432
// Can not remove a GT_IND if it is currently a CSE candidate.
1243612433
if (gtIsActiveCSE_Candidate(tree))
1243712434
{

0 commit comments

Comments
 (0)