Skip to content

Commit

Permalink
Fix asserts in Vector<> (#78765)
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo authored Nov 25, 2022
1 parent 0c46b34 commit 4f53c2f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/coreclr/jit/hwintrinsic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,10 @@ GenTree* Compiler::getArgForHWIntrinsic(var_types argType,
arg = impPopStack().val;
assert(varTypeIsArithmetic(arg->TypeGet()) || ((argType == TYP_BYREF) && arg->TypeIs(TYP_BYREF)));

assert(genActualType(arg->gtType) == genActualType(argType));
if (!impCheckImplicitArgumentCoercion(argType, arg->gtType))
{
BADCODE("the hwintrinsic argument has a type that can't be implicitly converted to the signature type");
}
}

return arg;
Expand Down
8 changes: 7 additions & 1 deletion src/coreclr/jit/simdashwintrinsic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,13 @@ GenTree* Compiler::impSimdAsHWIntrinsic(NamedIntrinsic intrinsic,
if (retType == TYP_STRUCT)
{
simdBaseJitType = getBaseJitTypeAndSizeOfSIMDType(sig->retTypeSigClass, &simdSize);
retType = getSIMDTypeForSize(simdSize);
if ((simdBaseJitType == CORINFO_TYPE_UNDEF) || !varTypeIsArithmetic(JitType2PreciseVarType(simdBaseJitType)) ||
(simdSize == 0))
{
// Unsupported type
return nullptr;
}
retType = getSIMDTypeForSize(simdSize);
}
else if (numArgs != 0)
{
Expand Down

0 comments on commit 4f53c2f

Please sign in to comment.