diff options
author | Sergey Andreenko <seandree@microsoft.com> | 2021-06-23 04:58:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-23 04:58:23 +0300 |
commit | 9701ef9e6cf8844e2fb0452177affc1e70e1c108 (patch) | |
tree | 53d52dc0f986130a43e67a58c6bd396098d92c73 /src/coreclr/jit | |
parent | 1f5033c333370334286861368205293abb0abee6 (diff) |
Keep obj node for ArrayIndex. (#54584)
Diffstat (limited to 'src/coreclr/jit')
-rw-r--r-- | src/coreclr/jit/morph.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/coreclr/jit/morph.cpp b/src/coreclr/jit/morph.cpp index 2d0d108a334..6d7f8c7bc6f 100644 --- a/src/coreclr/jit/morph.cpp +++ b/src/coreclr/jit/morph.cpp @@ -5509,8 +5509,16 @@ GenTree* Compiler::fgMorphArrayIndex(GenTree* tree) fgSetRngChkTarget(indexAddr); } - // Change `tree` into an indirection and return. - tree->ChangeOper(GT_IND); + if (!tree->TypeIs(TYP_STRUCT)) + { + tree->ChangeOper(GT_IND); + } + else + { + DEBUG_DESTROY_NODE(tree); + tree = gtNewObjNode(elemStructType, indexAddr); + INDEBUG(tree->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED); + } GenTreeIndir* const indir = tree->AsIndir(); indir->Addr() = indexAddr; bool canCSE = indir->CanCSE(); @@ -5520,9 +5528,7 @@ GenTree* Compiler::fgMorphArrayIndex(GenTree* tree) indir->SetDoNotCSE(); } -#ifdef DEBUG - indexAddr->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED; -#endif // DEBUG + INDEBUG(indexAddr->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED); return indir; } |