Fix Issue #877 - Use GT_OBJ when copying a struct (#40483)
authorBrian Sullivan <briansul@microsoft.com>
Fri, 7 Aug 2020 18:08:34 +0000 (11:08 -0700)
committerGitHub <noreply@github.com>
Fri, 7 Aug 2020 18:08:34 +0000 (11:08 -0700)
src/coreclr/src/jit/morph.cpp

index 61ad993..8134272 100644 (file)
@@ -5742,7 +5742,9 @@ GenTree* Compiler::fgMorphStackArgForVarArgs(unsigned lclNum, var_types varType,
         GenTree* tree;
         if (varTypeIsStruct(varType))
         {
-            tree = new (this, GT_BLK) GenTreeBlk(GT_BLK, TYP_STRUCT, ptrArg, typGetBlkLayout(varDsc->lvExactSize));
+            CORINFO_CLASS_HANDLE typeHnd = varDsc->lvVerTypeInfo.GetClassHandle();
+            assert(typeHnd != nullptr);
+            tree = gtNewObjNode(typeHnd, ptrArg);
         }
         else
         {