Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Andreenko <seandree@microsoft.com>2021-06-23 04:58:23 +0300
committerGitHub <noreply@github.com>2021-06-23 04:58:23 +0300
commit9701ef9e6cf8844e2fb0452177affc1e70e1c108 (patch)
tree53d52dc0f986130a43e67a58c6bd396098d92c73 /src/coreclr/jit
parent1f5033c333370334286861368205293abb0abee6 (diff)
Keep obj node for ArrayIndex. (#54584)
Diffstat (limited to 'src/coreclr/jit')
-rw-r--r--src/coreclr/jit/morph.cpp16
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;
}