Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'varDsc->lvExactSize == 12' assert. #38484

Merged
merged 4 commits into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/coreclr/src/jit/hwintrinsic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ var_types Compiler::getBaseTypeFromArgIfNeeded(NamedIntrinsic intrinsic,

CORINFO_CLASS_HANDLE Compiler::gtGetStructHandleForHWSIMD(var_types simdType, var_types simdBaseType)
{
if (m_simdHandleCache == nullptr)
{
return NO_CLASS_HANDLE;
}
if (simdType == TYP_SIMD16)
{
switch (simdBaseType)
Expand Down
22 changes: 10 additions & 12 deletions src/coreclr/src/jit/optcse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2638,17 +2638,15 @@ class CSE_Heuristic
// If all occurances were in GT_IND nodes it could still be NO_CLASS_HANDLE
//
CORINFO_CLASS_HANDLE structHnd = successfulCandidate->CseDsc()->csdStructHnd;
assert((structHnd != NO_CLASS_HANDLE) || (cseLclVarTyp != TYP_STRUCT));
if (structHnd != NO_CLASS_HANDLE)
{
m_pCompiler->lvaSetStruct(cseLclVarNum, structHnd, false);
}
#ifdef FEATURE_SIMD
else if (varTypeIsSIMD(cseLclVarTyp))
if (structHnd == NO_CLASS_HANDLE)
{
m_pCompiler->lvaGetDesc(cseLclVarNum)->lvSIMDType = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still set lvSIMDType to true for the new CSE SIMD LclVars?
Is it done by lvaSetStruct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes,lvaSetStruct handles it:

if (simdBaseType != TYP_UNKNOWN)
{
assert(varTypeIsSIMD(varDsc));
varDsc->lvSIMDType = true;
varDsc->lvBaseType = simdBaseType;

assert(varTypeIsSIMD(cseLclVarTyp));
// We are not setting it for `SIMD* indir` during the first path
// because it is not precise, see `optValnumCSE_Index`.
structHnd = m_pCompiler->gtGetStructHandle(successfulCandidate->CseDsc()->csdTree);
}
#endif // FEATURE_SIMD
assert(structHnd != NO_CLASS_HANDLE);
m_pCompiler->lvaSetStruct(cseLclVarNum, structHnd, false);
}
m_pCompiler->lvaTable[cseLclVarNum].lvType = cseLclVarTyp;
m_pCompiler->lvaTable[cseLclVarNum].lvIsCSE = true;
Expand Down Expand Up @@ -3214,9 +3212,9 @@ bool Compiler::optIsCSEcandidate(GenTree* tree)
return false;
}

// If this is a struct type, we can only consider it for CSE-ing if we can get at
// its handle, so that we can create a temp.
if ((type == TYP_STRUCT) && (gtGetStructHandleIfPresent(tree) == NO_CLASS_HANDLE))
// If this is a struct type (including SIMD*), we can only consider it for CSE-ing
// if we can get its handle, so that we can create a temp.
if (varTypeIsStruct(type) && (gtGetStructHandleIfPresent(tree) == NO_CLASS_HANDLE))
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,6 @@ public void Matrix4x4CreateRotationYCenterTest()

// A test for CreateFromAxisAngle(Vector3f,float)
[Fact]
[SkipOnCoreClr("https://github.com/dotnet/runtime/issues/36586", RuntimeTestModes.JitStress)]
public void Matrix4x4CreateFromAxisAngleTest()
{
float radians = MathHelper.ToRadians(-30.0f);
Expand Down