Skip to content
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
7 changes: 4 additions & 3 deletions src/coreclr/jit/importercalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4389,10 +4389,11 @@ GenTree* Compiler::impIntrinsic(CORINFO_CLASS_HANDLE clsHnd,
case NI_System_Type_get_IsPrimitive:
// getTypeForPrimitiveValueClass returns underlying type for enums, so we check it first
// because enums are not primitive types.
if ((info.compCompHnd->isEnum(hClass, nullptr) == TypeCompareState::MustNot) &&
info.compCompHnd->getTypeForPrimitiveValueClass(hClass) != CORINFO_TYPE_UNDEF)
if (info.compCompHnd->isEnum(hClass, nullptr) == TypeCompareState::MustNot)
{
retNode = gtNewTrue();
CorInfoType type = info.compCompHnd->getTypeForPrimitiveValueClass(hClass);
retNode =
gtNewIconNode((type != CORINFO_TYPE_UNDEF) && (type != CORINFO_TYPE_VOID) ? 1 : 0);
}
else
{
Expand Down
1 change: 1 addition & 0 deletions src/tests/JIT/Intrinsics/TypeIntrinsics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ private static void IsPrimitiveTests()
IsTrue(typeof(IntPtr).IsPrimitive);
IsTrue(typeof(UIntPtr).IsPrimitive);

IsFalse(typeof(void).IsPrimitive);
IsFalse(typeof(Enum).IsPrimitive);
IsFalse(typeof(ValueType).IsPrimitive);
IsFalse(typeof(SimpleEnum).IsPrimitive);
Expand Down
Loading