This repository was archived by the owner on Jan 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -10714,21 +10714,24 @@ GenTree* Compiler::fgMorphCopyBlock(GenTree* tree)
10714
10714
}
10715
10715
}
10716
10716
10717
+ // Check to see if we are doing a copy to/from the same local block.
10718
+ // If so, morph it to a nop.
10719
+ if ((destLclVar != nullptr) && (srcLclVar == destLclVar) && (destFldSeq == srcFldSeq) &&
10720
+ destFldSeq != FieldSeqStore::NotAField())
10721
+ {
10722
+ JITDUMP("Self-copy; replaced with a NOP.\n");
10723
+ GenTree* nop = gtNewNothingNode();
10724
+ INDEBUG(nop->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED);
10725
+ return nop;
10726
+ }
10727
+
10717
10728
// Check to see if we are required to do a copy block because the struct contains holes
10718
10729
// and either the src or dest is externally visible
10719
10730
//
10720
10731
bool requiresCopyBlock = false;
10721
10732
bool srcSingleLclVarAsg = false;
10722
10733
bool destSingleLclVarAsg = false;
10723
10734
10724
- if ((destLclVar != nullptr) && (srcLclVar == destLclVar) && (destFldSeq == srcFldSeq))
10725
- {
10726
- // Self-assign; no effect.
10727
- GenTree* nop = gtNewNothingNode();
10728
- INDEBUG(nop->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED);
10729
- return nop;
10730
- }
10731
-
10732
10735
// If either src or dest is a reg-sized non-field-addressed struct, keep the copyBlock.
10733
10736
if ((destLclVar != nullptr && destLclVar->lvRegStruct) || (srcLclVar != nullptr && srcLclVar->lvRegStruct))
10734
10737
{
You can’t perform that action at this time.
0 commit comments