summaryrefslogtreecommitdiff
path: root/src/jit/flowgraph.cpp
diff options
context:
space:
mode:
authorPat Gavlin <pagavlin@microsoft.com>2017-07-24 15:49:34 -0700
committerPat Gavlin <pagavlin@microsoft.com>2017-07-24 15:49:34 -0700
commit7dbc4b8165ba615c45c6433f17ade1659f861676 (patch)
tree7dd940d83f8bb771f8344e4a921f7cdeb750cb27 /src/jit/flowgraph.cpp
parentdd1e7ab81221127e47d59052c51c09921007d607 (diff)
downloadcoreclr-7dbc4b8165ba615c45c6433f17ade1659f861676.tar.gz
coreclr-7dbc4b8165ba615c45c6433f17ade1659f861676.tar.bz2
coreclr-7dbc4b8165ba615c45c6433f17ade1659f861676.zip
Fix `fgOrderBlockOps`.
This function was incorrect when the target was a `DYN_BLK` with `gtEvalSizeFirst` set to `true`. Fixes VSO 468726.
Diffstat (limited to 'src/jit/flowgraph.cpp')
-rw-r--r--src/jit/flowgraph.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp
index dfcf703d28..5dab6bb6b3 100644
--- a/src/jit/flowgraph.cpp
+++ b/src/jit/flowgraph.cpp
@@ -18718,15 +18718,14 @@ void Compiler::fgOrderBlockOps(GenTreePtr tree,
assert(srcPtrOrVal->OperIsIndir());
srcPtrOrVal = srcPtrOrVal->AsIndir()->Addr();
}
- GenTreePtr sizeNode = (destBlk->gtOper == GT_DYN_BLK) ? destBlk->AsDynBlk()->gtDynamicSize : nullptr;
- noway_assert((sizeNode != nullptr) || ((destBlk->gtFlags & GTF_REVERSE_OPS) == 0));
+
assert(destAddr != nullptr);
assert(srcPtrOrVal != nullptr);
GenTreePtr ops[3] = {
destAddr, // Dest address
srcPtrOrVal, // Val / Src address
- sizeNode // Size of block
+ nullptr // Size of block
};
regMaskTP regs[3] = {reg0, reg1, reg2};
@@ -18741,7 +18740,16 @@ void Compiler::fgOrderBlockOps(GenTreePtr tree,
{2, 1, 0} // true | GTF_REVERSE_OPS
};
- int orderNum = ((destBlk->gtFlags & GTF_REVERSE_OPS) != 0) * 1 + ((tree->gtFlags & GTF_REVERSE_OPS) != 0) * 2;
+ int orderNum = ((tree->gtFlags & GTF_REVERSE_OPS) == 0) ? 0 : 2;
+ if (destBlk->OperIs(GT_DYN_BLK))
+ {
+ GenTreeDynBlk* const dynBlk = destBlk->AsDynBlk();
+ if (dynBlk->gtEvalSizeFirst)
+ {
+ orderNum++;
+ }
+ ops[2] = dynBlk->gtDynamicSize;
+ }
assert(orderNum < 4);