summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarol Eidt <carol.eidt@microsoft.com>2018-07-10 09:55:53 -0700
committerGitHub <noreply@github.com>2018-07-10 09:55:53 -0700
commite1b1cde52abec8721b000b0e721c0788a1a81cc4 (patch)
tree7a50cdac9cb8892a3f8848ca43f9cd95b0c525f3
parentde61fa9811b0135113962fcf4ac745031580ee80 (diff)
parent0a04fd06050f11c1e99ad3114fe71594899bd46a (diff)
downloadcoreclr-e1b1cde52abec8721b000b0e721c0788a1a81cc4.tar.gz
coreclr-e1b1cde52abec8721b000b0e721c0788a1a81cc4.tar.bz2
coreclr-e1b1cde52abec8721b000b0e721c0788a1a81cc4.zip
Merge pull request #18757 from CarolEidt/Fix17969in2.1
Port the fix for Issue 17969 to Rel/2.1
-rw-r--r--src/jit/morph.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp
index 2c3c280a11..bd07098390 100644
--- a/src/jit/morph.cpp
+++ b/src/jit/morph.cpp
@@ -10714,6 +10714,17 @@ GenTree* Compiler::fgMorphCopyBlock(GenTree* tree)
}
}
+ // Check to see if we are doing a copy to/from the same local block.
+ // If so, morph it to a nop.
+ if ((destLclVar != nullptr) && (srcLclVar == destLclVar) && (destFldSeq == srcFldSeq) &&
+ destFldSeq != FieldSeqStore::NotAField())
+ {
+ JITDUMP("Self-copy; replaced with a NOP.\n");
+ GenTree* nop = gtNewNothingNode();
+ INDEBUG(nop->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED);
+ return nop;
+ }
+
// Check to see if we are required to do a copy block because the struct contains holes
// and either the src or dest is externally visible
//
@@ -10721,14 +10732,6 @@ GenTree* Compiler::fgMorphCopyBlock(GenTree* tree)
bool srcSingleLclVarAsg = false;
bool destSingleLclVarAsg = false;
- if ((destLclVar != nullptr) && (srcLclVar == destLclVar) && (destFldSeq == srcFldSeq))
- {
- // Self-assign; no effect.
- GenTree* nop = gtNewNothingNode();
- INDEBUG(nop->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED);
- return nop;
- }
-
// If either src or dest is a reg-sized non-field-addressed struct, keep the copyBlock.
if ((destLclVar != nullptr && destLclVar->lvRegStruct) || (srcLclVar != nullptr && srcLclVar->lvRegStruct))
{