@@ -2619,19 +2619,44 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis,
26192619 case NI_System_Type_op_Equality:
26202620 case NI_System_Type_op_Inequality:
26212621
2622- // Simple cases
2622+ // These may lead to early dead code elimination
2623+ case NI_System_Type_get_IsValueType:
2624+ case NI_System_Type_get_IsEnum:
2625+ case NI_System_Type_get_IsByRefLike:
2626+ case NI_System_Type_IsAssignableFrom:
2627+ case NI_System_Type_IsAssignableTo:
2628+
2629+ // Lightweight intrinsics
26232630 case NI_System_String_get_Chars:
26242631 case NI_System_String_get_Length:
26252632 case NI_System_Span_get_Item:
26262633 case NI_System_Span_get_Length:
26272634 case NI_System_ReadOnlySpan_get_Item:
26282635 case NI_System_ReadOnlySpan_get_Length:
2636+ case NI_System_BitConverter_DoubleToInt64Bits:
2637+ case NI_System_BitConverter_Int32BitsToSingle:
2638+ case NI_System_BitConverter_Int64BitsToDouble:
2639+ case NI_System_BitConverter_SingleToInt32Bits:
2640+ case NI_System_Buffers_Binary_BinaryPrimitives_ReverseEndianness:
2641+ case NI_System_Type_GetEnumUnderlyingType:
2642+
2643+ // Most atomics are compiled to single instructions
2644+ case NI_System_Threading_Interlocked_And:
2645+ case NI_System_Threading_Interlocked_Or:
2646+ case NI_System_Threading_Interlocked_CompareExchange:
2647+ case NI_System_Threading_Interlocked_Exchange:
2648+ case NI_System_Threading_Interlocked_ExchangeAdd:
2649+ case NI_System_Threading_Interlocked_MemoryBarrier:
2650+ case NI_System_Threading_Interlocked_ReadMemoryBarrier:
2651+
26292652 betterToExpand = true ;
26302653 break ;
26312654
26322655 default :
26332656 // Unsafe.* are all small enough to prefer expansions.
2634- betterToExpand = ni >= NI_SRCS_UNSAFE_START && ni <= NI_SRCS_UNSAFE_END;
2657+ betterToExpand |= ni >= NI_SRCS_UNSAFE_START && ni <= NI_SRCS_UNSAFE_END;
2658+ // Same for these
2659+ betterToExpand |= ni >= NI_PRIMITIVE_START && ni <= NI_PRIMITIVE_END;
26352660 break ;
26362661 }
26372662 }
0 commit comments