diff --git a/src/jit/codegenarmarch.cpp b/src/jit/codegenarmarch.cpp index 106ea2a74d2a..bbb151d1e1e1 100644 --- a/src/jit/codegenarmarch.cpp +++ b/src/jit/codegenarmarch.cpp @@ -700,8 +700,8 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode) // the xor ensures that only one of the two is setup, not both assert((varNode != nullptr) ^ (addrNode != nullptr)); - StructTypeLayout* layout = treeNode->gtLayout; - int structSize = layout->GetSize(); + StructTypeLayout* layout; + int structSize; bool isHfa; // This is the varNum for our load operations, @@ -720,14 +720,18 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode) assert(varDsc->lvType == TYP_STRUCT); assert(varDsc->lvOnFrame && !varDsc->lvRegister); +#ifdef _TARGET_ARM_ + layout = treeNode->gtLayout; +#else // _TARGET_ARM64_ + layout = varDsc->lvLayout; +#endif // _TARGET_ARM64_ + structSize = layout->GetSize(); + // This yields the roundUp size, but that is fine // as that is how much stack is allocated for this LclVar assert(structSize == varDsc->lvSize()); isHfa = varDsc->lvIsHfa(); -#ifdef _TARGET_ARM64_ - assert(layout == varDsc->lvLayout); -#endif // _TARGET_ARM_ } else // addrNode is used { @@ -747,10 +751,9 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode) } #endif // _TARGET_ARM64_ - isHfa = compiler->IsHfa(layout->GetClass()); -#ifdef _TARGET_ARM64_ - assert(layout == source->AsObj()->gtLayout); -#endif + layout = source->AsObj()->gtLayout; + structSize = layout->GetSize(); + isHfa = compiler->IsHfa(layout->GetClass()); } // If we have an HFA we can't have any GC pointers,