Filed for #96773
JIT doesn't see real type of the arr field and doesn't fold the condition.
public class MyList<T>
{
public T[] arr;
}
bool Test(MyList<string> list) => list.arr.GetType() == typeof(string[]);
Current codegen for Test:
; Method Program:Foo(MyList`1[System.String]):ubyte:this (FullOpts)
G_M55733_IG01:
G_M55733_IG02:
mov rax, gword ptr [rdx+0x08]
mov rcx, 0xD1FFAB1E ; System.String[]
cmp qword ptr [rax], rcx
sete al
movzx rax, al
G_M55733_IG03:
ret
; Total bytes of code: 24
Expected codegen:
Filed for #96773
JIT doesn't see real type of the
arrfield and doesn't fold the condition.Current codegen for
Test:Expected codegen: