From 7ba06433d5fe34bace2a67c82b84a5b4e5598576 Mon Sep 17 00:00:00 2001 From: Carol Eidt Date: Fri, 10 Feb 2017 10:34:09 -0800 Subject: [PATCH] Fix System.Numerics.Vectors CoreFx test failures CoreFx Issue 15713 is due to a case of an Indir(Addr(Field(Vector3 local))) which for some reason has a MorphAddrContext of MACK_Ind. Although I haven't fully identified why that is the case, we should be conservative in this case and mark the address as do-not-enregister. In addition, when attempting to debug this with a Checked JIT, I encountered an AV due to `GetJitTls` returning null in the `JITDUMP` calls in `getMaxIntrinsicSIMDVectorLength`. Again, I'm not sure why this would be the case but I have added guarding conditions. Commit migrated from https://github.com/dotnet/coreclr/commit/91be288f0d63c801f3aa6cbf9abd9ed852b0666f --- src/coreclr/src/jit/ee_il_dll.cpp | 15 ++++++++++++--- src/coreclr/src/jit/morph.cpp | 8 ++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/coreclr/src/jit/ee_il_dll.cpp b/src/coreclr/src/jit/ee_il_dll.cpp index d5705ab..a29a3ef 100644 --- a/src/coreclr/src/jit/ee_il_dll.cpp +++ b/src/coreclr/src/jit/ee_il_dll.cpp @@ -409,16 +409,25 @@ unsigned CILJit::getMaxIntrinsicSIMDVectorLength(DWORD cpuCompileFlags) { if (JitConfig.EnableAVX() != 0) { - JITDUMP("getMaxIntrinsicSIMDVectorLength: returning 32\n"); + if (GetJitTls() != nullptr && JitTls::GetCompiler() != nullptr) + { + JITDUMP("getMaxIntrinsicSIMDVectorLength: returning 32\n"); + } return 32; } } #endif // FEATURE_AVX_SUPPORT - JITDUMP("getMaxIntrinsicSIMDVectorLength: returning 16\n"); + if (GetJitTls() != nullptr && JitTls::GetCompiler() != nullptr) + { + JITDUMP("getMaxIntrinsicSIMDVectorLength: returning 16\n"); + } return 16; #endif // _TARGET_XARCH_ #else // !FEATURE_SIMD - JITDUMP("getMaxIntrinsicSIMDVectorLength: returning 0\n"); + if (GetJitTls() != nullptr && JitTls::GetCompiler() != nullptr) + { + JITDUMP("getMaxIntrinsicSIMDVectorLength: returning 0\n"); + } return 0; #endif // !FEATURE_SIMD } diff --git a/src/coreclr/src/jit/morph.cpp b/src/coreclr/src/jit/morph.cpp index 929c302..1132d6a 100644 --- a/src/coreclr/src/jit/morph.cpp +++ b/src/coreclr/src/jit/morph.cpp @@ -6163,6 +6163,14 @@ GenTreePtr Compiler::fgMorphField(GenTreePtr tree, MorphAddrContext* mac) return newTree; } } + else if ((objRef != nullptr) && (objRef->OperGet() == GT_ADDR) && varTypeIsSIMD(objRef->gtGetOp1())) + { + GenTreeLclVarCommon* lcl = objRef->IsLocalAddrExpr(); + if (lcl != nullptr) + { + lvaSetVarDoNotEnregister(lcl->gtLclNum DEBUGARG(DNER_LocalField)); + } + } #endif /* Is this an instance data member? */ -- 2.7.4