From 315ae461b2afa003c38fc8f9db0c781493cb049b Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Wed, 6 May 2020 09:50:49 -0700 Subject: [PATCH] Have SIMDIntrinsicUpperSave and SIMDIntrinsicUpperRestore set a baseType if one can't otherwise be determined --- src/coreclr/src/jit/lsra.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/coreclr/src/jit/lsra.cpp b/src/coreclr/src/jit/lsra.cpp index 61aef2c375deb8..8c9783cedad805 100644 --- a/src/coreclr/src/jit/lsra.cpp +++ b/src/coreclr/src/jit/lsra.cpp @@ -6755,6 +6755,17 @@ void LinearScan::insertUpperVectorSave(GenTree* tree, GenTreeSIMD* simdNode = new (compiler, GT_SIMD) GenTreeSIMD(LargeVectorSaveType, saveLcl, nullptr, SIMDIntrinsicUpperSave, varDsc->lvBaseType, genTypeSize(varDsc->lvType)); + + if (simdNode->gtSIMDBaseType == TYP_UNDEF) + { + // There are a few scenarios where we can get a LCL_VAR which + // doesn't know the underlying baseType. In that scenario, we + // will just lie and say it is a float. Codegen doesn't actually + // care what the type is but this avoids an assert that would + // otherwise be fired from the more general checks that happen. + simdNode->gtSIMDBaseType = TYP_FLOAT; + } + SetLsraAdded(simdNode); simdNode->SetRegNum(spillReg); if (spillToMem) @@ -6812,6 +6823,16 @@ void LinearScan::insertUpperVectorRestore(GenTree* tree, new (compiler, GT_SIMD) GenTreeSIMD(varDsc->lvType, restoreLcl, nullptr, SIMDIntrinsicUpperRestore, varDsc->lvBaseType, genTypeSize(varDsc->lvType)); + if (simdNode->gtSIMDBaseType == TYP_UNDEF) + { + // There are a few scenarios where we can get a LCL_VAR which + // doesn't know the underlying baseType. In that scenario, we + // will just lie and say it is a float. Codegen doesn't actually + // care what the type is but this avoids an assert that would + // otherwise be fired from the more general checks that happen. + simdNode->gtSIMDBaseType = TYP_FLOAT; + } + regNumber restoreReg = upperVectorInterval->physReg; SetLsraAdded(simdNode);