From 8f0d40f1daff21e62d1179564fed76fb5028ba38 Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Fri, 10 Jan 2025 15:35:46 -0800 Subject: [PATCH] JIT: run extra SPMI queries for arrays Work in anticipation of stack allocation of arrays, so that we can get decent diffs via SPMI. --- src/coreclr/jit/importer.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index 576e8be6f367ce..ba9a0e7ead79b0 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -9699,6 +9699,22 @@ void Compiler::impImportBlockCode(BasicBlock* block) /* Push the result of the call on the stack */ impPushOnStack(gtNewLclvNode(lclNum, TYP_REF), tiRetVal); + +#ifdef DEBUG + // Under SPMI, look up the array element type class handle + // and layout info (for arrays of structs) + // + if (JitConfig.EnableExtraSuperPmiQueries()) + { + CORINFO_CLASS_HANDLE elemClsHnd = NO_CLASS_HANDLE; + CorInfoType elemCorType = info.compCompHnd->getChildType(resolvedToken.hClass, &elemClsHnd); + var_types elemType = JITtype2varType(elemCorType); + if (elemType == TYP_STRUCT) + { + typGetObjLayout(elemClsHnd); + } + } +#endif } else {