From 16a568a369159ecbe28524e3784fb08e1af2a912 Mon Sep 17 00:00:00 2001 From: Bruce Forstall Date: Mon, 19 Dec 2022 22:47:43 -0800 Subject: [PATCH] Fix Checked/Release asm diffs Code inside a `#ifdef DEBUG` had a side-effect not visible to Release builds. Pull that code out of the `#ifdef`. Fixes #79560 --- src/coreclr/jit/codegenxarch.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/coreclr/jit/codegenxarch.cpp b/src/coreclr/jit/codegenxarch.cpp index dc344c1df7c0d..b838a387440cc 100644 --- a/src/coreclr/jit/codegenxarch.cpp +++ b/src/coreclr/jit/codegenxarch.cpp @@ -3808,11 +3808,9 @@ void CodeGen::genCodeForCpObj(GenTreeObj* cpObjNode) // Make sure we got the arguments of the cpobj operation in the right registers GenTree* dstAddr = cpObjNode->Addr(); GenTree* source = cpObjNode->Data(); - GenTree* srcAddr = nullptr; var_types srcAddrType = TYP_BYREF; bool dstOnStack = dstAddr->gtSkipReloadOrCopy()->OperIsLocalAddr(); -#ifdef DEBUG // If the GenTree node has data about GC pointers, this means we're dealing // with CpObj, so this requires special logic. assert(cpObjNode->GetLayout()->HasGCPtr()); @@ -3824,7 +3822,10 @@ void CodeGen::genCodeForCpObj(GenTreeObj* cpObjNode) if (!source->IsLocal()) { assert(source->gtOper == GT_IND); - srcAddr = source->gtGetOp1(); + GenTree* srcAddr = source->gtGetOp1(); + srcAddrType = srcAddr->TypeGet(); + +#ifdef DEBUG GenTree* actualSrcAddr = srcAddr->gtSkipReloadOrCopy(); GenTree* actualDstAddr = dstAddr->gtSkipReloadOrCopy(); unsigned srcLclVarNum = BAD_VAR_NUM; @@ -3845,9 +3846,8 @@ void CodeGen::genCodeForCpObj(GenTreeObj* cpObjNode) ((srcLclVarNum == dstLclVarNum) && !isDstAddrLiveOut)); assert((actualDstAddr->GetRegNum() != REG_RDI) || !isDstAddrLiveOut || ((srcLclVarNum == dstLclVarNum) && !isSrcAddrLiveOut)); - srcAddrType = srcAddr->TypeGet(); - } #endif // DEBUG + } // Consume the operands and get them into the right registers. // They may now contain gc pointers (depending on their type; gcMarkRegPtrVal will "do the right thing").