未验证 提交 380a4723 编写于 作者: S SingleAccretion 提交者: GitHub

Fix a couple issues with GTF_GLOB_REF setting (#66247)

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.
上级 88c2a664
......@@ -4917,12 +4917,6 @@ void Compiler::fgMakeOutgoingStructArgCopy(GenTreeCall* call, GenTreeCall::Use*
GenTree* dest = gtNewLclvNode(tmp, lvaTable[tmp].lvType);
dest->gtFlags |= (GTF_DONT_CSE | GTF_VAR_DEF); // This is a def of the local, "entire" by construction.
if (argx->gtOper == GT_OBJ)
{
argx->gtFlags &= ~(GTF_ALL_EFFECT) | (argx->AsBlk()->Addr()->gtFlags & GTF_ALL_EFFECT);
argx->SetIndirExceptionFlags(this);
}
// Copy the valuetype to the temp
GenTree* copyBlk = gtNewBlkOpNode(dest, argx, false /* not volatile */, true /* copyBlock */);
copyBlk = fgMorphCopyBlock(copyBlk);
......@@ -12419,19 +12413,22 @@ DONE_MORPHING_CHILDREN:
break;
case GT_OBJ:
// If we have GT_OBJ(GT_ADDR(X)) and X has GTF_GLOB_REF, we must set GTF_GLOB_REF on
// the GT_OBJ. Note that the GTF_GLOB_REF will have been cleared on ADDR(X) where X
// is a local or clsVar, even if it has been address-exposed.
if (op1->OperGet() == GT_ADDR)
case GT_BLK:
case GT_IND:
{
// If we have IND(ADDR(X)) and X has GTF_GLOB_REF, we must set GTF_GLOB_REF on
// the OBJ. Note that the GTF_GLOB_REF will have been cleared on ADDR(X) where X
// is a local or CLS_VAR, even if it has been address-exposed.
if (op1->OperIs(GT_ADDR))
{
GenTreeUnOp* addr = op1->AsUnOp();
GenTree* addrOp = addr->gtGetOp1();
tree->gtFlags |= (addrOp->gtFlags & GTF_GLOB_REF);
tree->gtFlags |= (op1->AsUnOp()->gtGetOp1()->gtFlags & GTF_GLOB_REF);
}
if (!tree->OperIs(GT_IND))
{
break;
}
break;
case GT_IND:
{
// Can not remove a GT_IND if it is currently a CSE candidate.
if (gtIsActiveCSE_Candidate(tree))
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册