diff --git a/src/coreclr/jit/lower.cpp b/src/coreclr/jit/lower.cpp index ae5a41c52e682..29e0f708f72d9 100644 --- a/src/coreclr/jit/lower.cpp +++ b/src/coreclr/jit/lower.cpp @@ -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; @@ -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); diff --git a/src/coreclr/jit/morph.cpp b/src/coreclr/jit/morph.cpp index 05ddcc0a2a327..ff3285baed467 100644 --- a/src/coreclr/jit/morph.cpp +++ b/src/coreclr/jit/morph.cpp @@ -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