Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow inlining array methods (#88367)
`CanInline` would return false to methods that implement generic interfaces on arrays because we didn't consider the magic `Array<T>` types constructed. For: ```csharp static int Main() { IReadOnlyCollection<int> l = new int[] { 1, 2, 3 }; return l.Count; } ``` Before: ``` sub rsp, 40 ;; size=4 bbWeight=1 PerfScore 0.25 G_M24375_IG02: ;; offset=0004H lea rcx, [(reloc 0x4000000000420a70)] ; int[] mov edx, 3 call CORINFO_HELP_NEWARR_1_VC lea rcx, [(reloc 0x4000000000420aa8)] ; const ptr mov rdx, qword ptr [rcx] mov qword ptr [rax+10H], rdx mov rdx, qword ptr [rcx+04H] mov qword ptr [rax+14H], rdx mov rcx, rax call System.Array`1[int]:get_Count():int:this nop ;; size=48 bbWeight=1 PerfScore 9.75 G_M24375_IG03: ;; offset=0034H add rsp, 40 ret ``` After: ``` sub rsp, 40 ;; size=4 bbWeight=1 PerfScore 0.25 G_M24375_IG02: ;; offset=0004H lea rcx, [(reloc 0x4000000000420a70)] ; int[] mov edx, 3 call CORINFO_HELP_NEWARR_1_VC lea rcx, [(reloc 0x4000000000420aa8)] ; const ptr mov rdx, qword ptr [rcx] mov qword ptr [rax+10H], rdx mov rdx, qword ptr [rcx+04H] mov qword ptr [rax+14H], rdx mov eax, 3 ;; size=44 bbWeight=1 PerfScore 8.50 G_M24375_IG03: ;; offset=0030H add rsp, 40 ret ```
- Loading branch information