diff options
-rw-r--r-- | src/jit/morph.cpp | 28 | ||||
-rw-r--r-- | tests/src/JIT/Methodical/tailcall/_il_dbgtest_3b.ilproj | 1 | ||||
-rw-r--r-- | tests/testsRunningInsideARM.txt | 1 |
3 files changed, 25 insertions, 5 deletions
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp index 73883e57b4..b5d2e8a96f 100644 --- a/src/jit/morph.cpp +++ b/src/jit/morph.cpp @@ -4963,11 +4963,18 @@ GenTreePtr Compiler::fgMorphMultiregStructArg(GenTreePtr arg, fgArgTabEntryPtr f objClass = argObj->gtClass; structSize = info.compCompHnd->getClassSize(objClass); - // If we have a GT_OBJ of a GT_ADDR then we set argValue to the child node of the GT_ADDR - // - if (argObj->gtOp1->OperGet() == GT_ADDR) + // If we have a GT_OBJ of a GT_ADDR then we set argValue to the child node of the GT_ADDR. + GenTree* op1 = argObj->gtOp1; + if (op1->OperGet() == GT_ADDR) { - argValue = argObj->gtOp1->gtOp.gtOp1; + GenTree* underlyingTree = op1->gtOp.gtOp1; + + // Only update to the same type. + if ((underlyingTree->TypeGet() == argValue->TypeGet()) && + (objClass == gtGetStructHandleIfPresent(underlyingTree))) + { + argValue = underlyingTree; + } } } else if (arg->OperGet() == GT_LCL_VAR) @@ -5342,6 +5349,19 @@ GenTreePtr Compiler::fgMorphMultiregStructArg(GenTreePtr arg, fgArgTabEntryPtr f GenTreePtr baseAddr = argObj->gtOp1; var_types addrType = baseAddr->TypeGet(); + if (baseAddr->OperGet() == GT_ADDR) + { + GenTree* addrTaken = baseAddr->gtOp.gtOp1; + if (addrTaken->IsLocal()) + { + GenTreeLclVarCommon* varNode = addrTaken->AsLclVarCommon(); + unsigned varNum = varNode->gtLclNum; + // We access non-struct type (for example, long) as a struct type. + // Make sure lclVar lives on stack to make sure its fields are accessible by address. + lvaSetVarDoNotEnregister(varNum DEBUGARG(DNER_LocalField)); + } + } + // Create a new tree for 'arg' // replace the existing LDOBJ(EXPR) // with a FIELD_LIST(IND(EXPR), FIELD_LIST(IND(EXPR+8), nullptr) ...) diff --git a/tests/src/JIT/Methodical/tailcall/_il_dbgtest_3b.ilproj b/tests/src/JIT/Methodical/tailcall/_il_dbgtest_3b.ilproj index 114e9e8e7c..fb6053ca1c 100644 --- a/tests/src/JIT/Methodical/tailcall/_il_dbgtest_3b.ilproj +++ b/tests/src/JIT/Methodical/tailcall/_il_dbgtest_3b.ilproj @@ -10,7 +10,6 @@ <OutputType>Exe</OutputType> <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> - <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <!-- Default configurations to help VS understand the configurations --> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup> diff --git a/tests/testsRunningInsideARM.txt b/tests/testsRunningInsideARM.txt index de33d2e86b..507bfc4145 100644 --- a/tests/testsRunningInsideARM.txt +++ b/tests/testsRunningInsideARM.txt @@ -1,5 +1,6 @@ JIT/Directed/coverage/importer/ldelemnullarr2/ JIT/Methodical/Coverage/b39946/ +JIT/Methodical/tailcall/_il_dbgtest_3b/ JIT/Regression/CLR-x86-JIT/V1-M09.5-PDC/b26863/b26863/ JIT/Regression/CLR-x86-JIT/V1-M09.5-PDC/b28037/b28037/ JIT/Regression/CLR-x86-JIT/V1-M09.5-PDC/b29068/b29068/ |