Skip to content

Commit

Permalink
Preserve OBJ/BLK on the RHS of ASG
Browse files Browse the repository at this point in the history
One of my upcoming changes will need this information to
accurately detect type mismatch in "fgValueNumberBlockAssignment".
  • Loading branch information
SingleAccretion committed Jan 13, 2022
1 parent 64c05a3 commit f5d6569
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
10 changes: 9 additions & 1 deletion src/coreclr/jit/lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6922,6 +6922,14 @@ void Lowering::TransformUnusedIndirection(GenTreeIndir* ind, Compiler* comp, Bas
void Lowering::LowerBlockStoreCommon(GenTreeBlk* blkNode)
{
assert(blkNode->OperIs(GT_STORE_BLK, GT_STORE_DYN_BLK, GT_STORE_OBJ));

// Lose the type information stored in the source - we no longer need it.
if (blkNode->Data()->OperIs(GT_OBJ, GT_BLK))
{
blkNode->Data()->SetOper(GT_IND);
LowerIndir(blkNode->Data()->AsIndir());
}

if (TryTransformStoreObjAsStoreInd(blkNode))
{
return;
Expand Down Expand Up @@ -6996,7 +7004,7 @@ bool Lowering::TryTransformStoreObjAsStoreInd(GenTreeBlk* blkNode)
return false;
}

JITDUMP("Replacing STORE_OBJ with STOREIND for [06%u]", blkNode->gtTreeID);
JITDUMP("Replacing STORE_OBJ with STOREIND for [%06u]\n", blkNode->gtTreeID);
blkNode->ChangeOper(GT_STOREIND);
blkNode->ChangeType(regType);

Expand Down
11 changes: 2 additions & 9 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10431,15 +10431,8 @@ GenTree* Compiler::fgMorphBlockOperand(GenTree* tree, var_types asgType, unsigne
{
if (indirTree != nullptr)
{
if (indirTree->OperIsBlk() && !isBlkReqd)
{
effectiveVal->SetOper(GT_IND);
}
else
{
// If we have an indirection and a block is required, it should already be a block.
assert(indirTree->OperIsBlk() || !isBlkReqd);
}
// If we have an indirection and a block is required, it should already be a block.
assert(indirTree->OperIsBlk() || !isBlkReqd);
effectiveVal->gtType = asgType;
}
else
Expand Down

0 comments on commit f5d6569

Please sign in to comment.