diff options
author | Carol Eidt <carol.eidt@microsoft.com> | 2019-05-31 11:02:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-31 11:02:02 -0700 |
commit | 0d21b57657f8135622797f0db29460c975dd2339 (patch) | |
tree | 8f7d361c79355f08c55e700ee64d7ee35310683d /src/jit/codegenxarch.cpp | |
parent | 795f2fd2a67047519b477cd1776626368c88e73c (diff) | |
download | coreclr-0d21b57657f8135622797f0db29460c975dd2339.tar.gz coreclr-0d21b57657f8135622797f0db29460c975dd2339.tar.bz2 coreclr-0d21b57657f8135622797f0db29460c975dd2339.zip |
Handle a zero byte cpblk (#24871)
Fix #24846
Diffstat (limited to 'src/jit/codegenxarch.cpp')
-rw-r--r-- | src/jit/codegenxarch.cpp | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/src/jit/codegenxarch.cpp b/src/jit/codegenxarch.cpp index 0f07cf13e0..3855e2cfe8 100644 --- a/src/jit/codegenxarch.cpp +++ b/src/jit/codegenxarch.cpp @@ -3270,25 +3270,19 @@ void CodeGen::genCodeForCpBlkRepMovs(GenTreeBlk* cpBlkNode) GenTree* source = cpBlkNode->Data(); GenTree* srcAddr = nullptr; -#ifdef DEBUG assert(dstAddr->isUsedFromReg()); assert(source->isContained()); #ifdef _TARGET_X86_ - if (size == 0) + if (!cpBlkNode->OperIs(GT_STORE_DYN_BLK)) { - noway_assert(cpBlkNode->OperGet() == GT_STORE_DYN_BLK); + assert((size == 0) || (size > CPBLK_UNROLL_LIMIT)); } - else -#endif - { -#ifdef _TARGET_AMD64_ - assert(size > CPBLK_UNROLL_LIMIT && size < CPBLK_MOVS_LIMIT); -#else - assert(size > CPBLK_UNROLL_LIMIT); +#else // _TARGET_AMD64_ + // On x64 we use the helper call for GT_STORE_DYN_BLK. + assert(!cpBlkNode->OperIs(GT_STORE_DYN_BLK)); + assert((size == 0) || ((size > CPBLK_UNROLL_LIMIT) && (size < CPBLK_MOVS_LIMIT))); #endif - } -#endif // DEBUG genConsumeBlockOp(cpBlkNode, REG_RDI, REG_RSI, REG_RCX); instGen(INS_r_movsb); @@ -3791,15 +3785,11 @@ void CodeGen::genCodeForCpBlk(GenTreeBlk* cpBlkNode) GenTree* srcAddr = nullptr; // Size goes in arg2 - if (blockSize != 0) + if (cpBlkNode->gtOper != GT_STORE_DYN_BLK) { assert(blockSize >= CPBLK_MOVS_LIMIT); assert((cpBlkNode->gtRsvdRegs & RBM_ARG_2) != 0); } - else - { - noway_assert(cpBlkNode->gtOper == GT_STORE_DYN_BLK); - } // Source address goes in arg1 if (source->gtOper == GT_IND) |