-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone
Description
Minimal repro for https://github.com/dotnet/runtime/pull/88560/files#r1264791578
class Program
{
static void Main()
{
Test(42); // <int> specialization
}
[MethodImpl(MethodImplOptions.NoInlining)]
static void Test<T>(T value)
{
if (value is IEnumerable enumerable) // always false for <int>
Consume(enumerable);
}
[MethodImpl(MethodImplOptions.NoInlining)]
static void Consume(object o) { }
}Tier1 codegen for Test<int>:
; Assembly listing for method Program:Test[int](int) (FullOpts)
ret
; Total bytes of code 1Tier0 codegen for Test<int>:
; Assembly listing for method Program:Test[int](int) (Tier0)
push rbp
sub rsp, 48
lea rbp, [rsp+30H]
xor eax, eax
mov qword ptr [rbp-08H], rax
mov qword ptr [rbp-10H], rax
mov dword ptr [rbp+10H], ecx
mov rcx, 0xD1FFAB1E ; System.Int32
call CORINFO_HELP_NEWSFAST ;;;;; <-------- allocation (boxing)
mov gword ptr [rbp-10H], rax
mov rdx, gword ptr [rbp-10H]
mov ecx, dword ptr [rbp+10H]
mov dword ptr [rdx+08H], ecx
mov rdx, gword ptr [rbp-10H]
mov rcx, 0xD1FFAB1E ; System.Collections.IEnumerable
call [CORINFO_HELP_ISINSTANCEOFINTERFACE]
mov gword ptr [rbp-08H], rax
cmp gword ptr [rbp-08H], 0
je SHORT G_M5413_IG03
mov rcx, gword ptr [rbp-08H]
call [Program:Consume(System.Object)]
G_M5413_IG03:
nop
add rsp, 48
pop rbp
ret
; Total bytes of code 100GerardSmit
Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI