summaryrefslogtreecommitdiff
path: root/src/jit
diff options
context:
space:
mode:
authorPat Gavlin <pgavlin@gmail.com>2016-12-07 15:16:09 -0800
committerGitHub <noreply@github.com>2016-12-07 15:16:09 -0800
commitbea2a8cf3d1ffe90683c47758f27f7cc83850982 (patch)
tree15f36e6d9851e0f37769abd999b18d204709b1af /src/jit
parent2d888b52df39e32e5f1c3e92ace9824deb0c8a82 (diff)
parent83a0f89cc1f0fcbe96a16299f5acc6b88c1a9f56 (diff)
downloadcoreclr-bea2a8cf3d1ffe90683c47758f27f7cc83850982.tar.gz
coreclr-bea2a8cf3d1ffe90683c47758f27f7cc83850982.tar.bz2
coreclr-bea2a8cf3d1ffe90683c47758f27f7cc83850982.zip
Merge pull request #8505 from pgavlin/VSO297215
Use a left-leaning comma tree when morphing a stelem.ref helper.
Diffstat (limited to 'src/jit')
-rw-r--r--src/jit/morph.cpp33
1 files changed, 15 insertions, 18 deletions
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp
index f0312c0571..aef6029b16 100644
--- a/src/jit/morph.cpp
+++ b/src/jit/morph.cpp
@@ -8141,8 +8141,7 @@ NO_TAIL_CALL:
// Either or both of the array and index arguments may have been spilled to temps by `fgMorphArgs`. Copy
// the spill trees as well if necessary.
- GenTree* argSetup = nullptr;
- GenTreeOp* argSetupCursor = nullptr;
+ GenTreeOp* argSetup = nullptr;
for (GenTreeArgList* earlyArgs = call->gtCallArgs; earlyArgs != nullptr; earlyArgs = earlyArgs->Rest())
{
GenTree* const arg = earlyArgs->Current();
@@ -8154,24 +8153,21 @@ NO_TAIL_CALL:
assert(arg != arr);
assert(arg != index);
- // NOTE: we pass `arg` as both op1 and op2 of the comma becuase the constructor insists that we provide
- // a non-null op2. The value of op2 will later be replaced with either the comma node for the next arg
- // setup node or with the eventual assignment node that replaces the call.
- GenTreeOp* commaNode = new (this, GT_COMMA) GenTreeOp(GT_COMMA, TYP_VOID, arg, arg);
- if (argSetup == nullptr)
- {
- argSetup = commaNode;
- }
- else
+ arg->gtFlags &= ~GTF_LATE_ARG;
+
+ GenTree* op1 = argSetup;
+ if (op1 == nullptr)
{
- assert(argSetupCursor != nullptr);
- argSetupCursor->gtOp2 = commaNode;
+ op1 = gtNewNothingNode();
+#if DEBUG
+ op1->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED;
+#endif // DEBUG
}
- argSetupCursor = commaNode;
+ argSetup = new (this, GT_COMMA) GenTreeOp(GT_COMMA, TYP_VOID, op1, arg);
#if DEBUG
- commaNode->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED;
+ argSetup->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED;
#endif // DEBUG
}
@@ -8194,9 +8190,10 @@ NO_TAIL_CALL:
GenTree* result = fgMorphTree(arrStore);
if (argSetup != nullptr)
{
- assert(argSetupCursor != nullptr);
- argSetupCursor->gtOp2 = result;
- result = argSetup;
+ result = new (this, GT_COMMA) GenTreeOp(GT_COMMA, TYP_VOID, argSetup, result);
+#if DEBUG
+ result->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED;
+#endif // DEBUG
}
return result;