Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JitDiff X64] [xtqqczze] Refactor memory copies in SafeBuffer #548

Open
MihuBot opened this issue Jul 22, 2024 · 3 comments
Open

[JitDiff X64] [xtqqczze] Refactor memory copies in SafeBuffer #548

MihuBot opened this issue Jul 22, 2024 · 3 comments

Comments

@MihuBot
Copy link
Owner

MihuBot commented Jul 22, 2024

Job completed in 14 minutes.
dotnet/runtime#105206

Diffs

Found 261 files with textual diffs.

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 39655437
Total bytes of diff: 39654923
Total bytes of delta: -514 (-0.00 % of base)
Total relative delta: -2.06
    diff is an improvement.
    relative diff is an improvement.


Top file improvements (bytes):
        -514 : System.Private.CoreLib.dasm (-0.01 % of base)

1 total files with Code Size differences (1 improved, 0 regressed), 258 unchanged.

Top method regressions (bytes):
          13 (4.42 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:ReadSpan[System.Numerics.Vector`1[float]](ulong,System.Span`1[System.Numerics.Vector`1[float]]):this (FullOpts)
          13 (4.42 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:WriteSpan[System.Numerics.Vector`1[float]](ulong,System.ReadOnlySpan`1[System.Numerics.Vector`1[float]]):this (FullOpts)

Top method improvements (bytes):
         -45 (-18.83 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Read[ubyte](ulong):ubyte:this (FullOpts)
         -44 (-18.57 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Read[int](ulong):int:this (FullOpts)
         -44 (-18.41 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Read[long](ulong):long:this (FullOpts)
         -44 (-18.41 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Read[short](ulong):short:this (FullOpts)
         -37 (-15.42 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Read[double](ulong):double:this (FullOpts)
         -35 (-13.16 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Read[System.Numerics.Vector`1[float]](ulong):System.Numerics.Vector`1[float]:this (FullOpts)
         -29 (-12.45 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Write[double](ulong,double):this (FullOpts)
         -25 (-10.78 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Write[long](ulong,long):this (FullOpts)
         -24 (-10.39 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Write[int](ulong,int):this (FullOpts)
         -24 (-10.39 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Write[ubyte](ulong,ubyte):this (FullOpts)
         -23 (-9.96 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Write[short](ulong,short):this (FullOpts)
         -23 (-10.09 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Write[System.Numerics.Vector`1[float]](ulong,System.Numerics.Vector`1[float]):this (FullOpts)
         -19 (-6.35 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:WriteSpan[long](ulong,System.ReadOnlySpan`1[long]):this (FullOpts)
         -17 (-5.72 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:WriteSpan[int](ulong,System.ReadOnlySpan`1[int]):this (FullOpts)
         -17 (-5.69 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:WriteSpan[short](ulong,System.ReadOnlySpan`1[short]):this (FullOpts)
         -16 (-5.35 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:ReadSpan[long](ulong,System.Span`1[long]):this (FullOpts)
         -16 (-5.39 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:WriteSpan[ubyte](ulong,System.ReadOnlySpan`1[ubyte]):this (FullOpts)
         -15 (-5.02 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:WriteSpan[double](ulong,System.ReadOnlySpan`1[double]):this (FullOpts)
         -14 (-4.71 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:ReadSpan[int](ulong,System.Span`1[int]):this (FullOpts)
         -14 (-4.68 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:ReadSpan[short](ulong,System.Span`1[short]):this (FullOpts)
         -13 (-4.38 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:ReadSpan[ubyte](ulong,System.Span`1[ubyte]):this (FullOpts)
          -2 (-0.67 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:ReadSpan[double](ulong,System.Span`1[double]):this (FullOpts)

Top method regressions (percentages):
          13 (4.42 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:ReadSpan[System.Numerics.Vector`1[float]](ulong,System.Span`1[System.Numerics.Vector`1[float]]):this (FullOpts)
          13 (4.42 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:WriteSpan[System.Numerics.Vector`1[float]](ulong,System.ReadOnlySpan`1[System.Numerics.Vector`1[float]]):this (FullOpts)

Top method improvements (percentages):
         -45 (-18.83 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Read[ubyte](ulong):ubyte:this (FullOpts)
         -44 (-18.57 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Read[int](ulong):int:this (FullOpts)
         -44 (-18.41 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Read[long](ulong):long:this (FullOpts)
         -44 (-18.41 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Read[short](ulong):short:this (FullOpts)
         -37 (-15.42 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Read[double](ulong):double:this (FullOpts)
         -35 (-13.16 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Read[System.Numerics.Vector`1[float]](ulong):System.Numerics.Vector`1[float]:this (FullOpts)
         -29 (-12.45 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Write[double](ulong,double):this (FullOpts)
         -25 (-10.78 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Write[long](ulong,long):this (FullOpts)
         -24 (-10.39 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Write[int](ulong,int):this (FullOpts)
         -24 (-10.39 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Write[ubyte](ulong,ubyte):this (FullOpts)
         -23 (-10.09 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Write[System.Numerics.Vector`1[float]](ulong,System.Numerics.Vector`1[float]):this (FullOpts)
         -23 (-9.96 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:Write[short](ulong,short):this (FullOpts)
         -19 (-6.35 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:WriteSpan[long](ulong,System.ReadOnlySpan`1[long]):this (FullOpts)
         -17 (-5.72 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:WriteSpan[int](ulong,System.ReadOnlySpan`1[int]):this (FullOpts)
         -17 (-5.69 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:WriteSpan[short](ulong,System.ReadOnlySpan`1[short]):this (FullOpts)
         -16 (-5.39 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:WriteSpan[ubyte](ulong,System.ReadOnlySpan`1[ubyte]):this (FullOpts)
         -16 (-5.35 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:ReadSpan[long](ulong,System.Span`1[long]):this (FullOpts)
         -15 (-5.02 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:WriteSpan[double](ulong,System.ReadOnlySpan`1[double]):this (FullOpts)
         -14 (-4.71 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:ReadSpan[int](ulong,System.Span`1[int]):this (FullOpts)
         -14 (-4.68 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:ReadSpan[short](ulong,System.Span`1[short]):this (FullOpts)
         -13 (-4.38 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:ReadSpan[ubyte](ulong,System.Span`1[ubyte]):this (FullOpts)
          -2 (-0.67 % of base) : System.Private.CoreLib.dasm - System.Runtime.InteropServices.SafeBuffer:ReadSpan[double](ulong,System.Span`1[double]):this (FullOpts)

24 total methods with Code Size differences (22 improved, 2 regressed), 231354 unchanged.

--------------------------------------------------------------------------------

Artifacts:

@MihuBot
Copy link
Owner Author

MihuBot commented Jul 22, 2024

Top method regressions

13 (4.42 % of base) - System.Runtime.InteropServices.SafeBuffer:ReadSpan[System.Numerics.Vector`1[float]](ulong,System.Span`1[System.Numerics.Vector`1[float]]):this
 ; Assembly listing for method System.Runtime.InteropServices.SafeBuffer:ReadSpan[System.Numerics.Vector`1[float]](ulong,System.Span`1[System.Numerics.Vector`1[float]]):this (FullOpts)
 ; Emitting BLENDED_CODE for X64 with AVX512 - Unix
 ; FullOpts code
 ; optimized code
 ; rbp based frame
 ; fully interruptible
 ; No PGO data
-; 0 inlinees with PGO data; 4 single block inlinees; 1 inlinees without PGO data
+; 0 inlinees with PGO data; 4 single block inlinees; 0 inlinees without PGO data
 ; Final local variable assignments
 ;
 ;  V00 this         [V00,T03] (  8,  6.50)     ref  ->  [rbp-0x30]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
 ;  V01 arg1         [V01,T06] (  3,  3   )    long  ->  r15         single-def
 ;* V02 arg2         [V02    ] (  0,  0   )  struct (16) zero-ref    multireg-arg ld-addr-op single-def <System.Span`1[System.Numerics.Vector`1[float]]>
 ;  V03 loc0         [V03,T09] (  2,  2   )     int  ->  rax        
 ;  V04 loc1         [V04,T04] (  3,  6   )    long  ->  r15        
 ;  V05 loc2         [V05    ] (  4,  3   )   ubyte  ->  [rbp-0x28]  do-not-enreg[X] addr-exposed ld-addr-op
 ;  V06 loc3         [V06,T07] (  2,  5   )   byref  ->  r14         single-def
 ;  V07 loc4         [V07,T00] (  5, 17   )     int  ->  rdi        
 ;# V08 OutArgs      [V08    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
 ;* V09 tmp1         [V09    ] (  0,  0   )    long  ->  zero-ref    "impAppendStmt"
 ;* V10 tmp2         [V10    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.Span`1[System.Numerics.Vector`1[float]]>
-;* V11 tmp3         [V11    ] (  0,  0   )   byref  ->  zero-ref    "Inlining Arg"
-;* V12 tmp4         [V12    ] (  0,  0   )   byref  ->  zero-ref    "Inlining Arg"
-;  V13 tmp5         [V13,T08] (  2,  2   )   byref  ->  r14         single-def "field V02._reference (fldOffset=0x0)" P-INDEP
-;  V14 tmp6         [V14,T02] (  4,  7   )     int  ->  rbx         single-def "field V02._length (fldOffset=0x8)" P-INDEP
-;* V15 tmp7         [V15    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V10._reference (fldOffset=0x0)" P-INDEP
-;* V16 tmp8         [V16    ] (  0,  0   )     int  ->  zero-ref    "field V10._length (fldOffset=0x8)" P-INDEP
-;  V17 PSPSym       [V17,T10] (  1,  1   )    long  ->  [rbp-0x40]  do-not-enreg[V] "PSPSym"
-;  V18 cse0         [V18,T05] (  3,  6   )    long  ->  r13         "CSE #01: aggressive"
-;  V19 cse1         [V19,T01] (  3, 12   )    long  ->  rsi         "CSE #02: aggressive"
+;  V11 tmp3         [V11,T08] (  2,  2   )   byref  ->  r14         single-def "field V02._reference (fldOffset=0x0)" P-INDEP
+;  V12 tmp4         [V12,T02] (  4,  7   )     int  ->  rbx         single-def "field V02._length (fldOffset=0x8)" P-INDEP
+;* V13 tmp5         [V13    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V10._reference (fldOffset=0x0)" P-INDEP
+;* V14 tmp6         [V14    ] (  0,  0   )     int  ->  zero-ref    "field V10._length (fldOffset=0x8)" P-INDEP
+;  V15 PSPSym       [V15,T10] (  1,  1   )    long  ->  [rbp-0x40]  do-not-enreg[V] "PSPSym"
+;  V16 cse0         [V16,T05] (  3,  6   )    long  ->  r13         "CSE #01: aggressive"
+;  V17 cse1         [V17,T01] (  3, 12   )    long  ->  rsi         "CSE #02: aggressive"
 ;
 ; Lcl frame size = 32
 
 G_M7477_IG01:
        push     rbp
        push     r15
        push     r14
        push     r13
        push     rbx
        sub      rsp, 32
        lea      rbp, [rsp+0x40]
        mov      qword ptr [rbp-0x40], rsp
        mov      gword ptr [rbp-0x30], rdi
        mov      r15, rsi
        mov      r14, rdx
        mov      ebx, ecx
 						;; size=33 bbWeight=1 PerfScore 8.50
 G_M7477_IG02:
        cmp      qword ptr [rdi+0x18], -1
        je       G_M7477_IG09
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:AlignedSizeOf[System.Numerics.Vector`1[float]]():uint
        call     [rax]System.Runtime.InteropServices.SafeBuffer:AlignedSizeOf[System.Numerics.Vector`1[float]]():uint
        mov      rdi, gword ptr [rbp-0x30]
        add      r15, qword ptr [rdi+0x08]
        mov      r13d, eax
        mov      edx, ebx
        imul     rdx, r13
        jo       G_M7477_IG10
        test     rdx, rdx
        jl       G_M7477_IG10
        mov      rsi, r15
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        xor      esi, esi
        mov      dword ptr [rbp-0x28], esi
 						;; size=75 bbWeight=1 PerfScore 20.75
 G_M7477_IG03:
        lea      rsi, [rbp-0x28]
        mov      rdi, gword ptr [rbp-0x30]
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
        xor      edi, edi
        test     ebx, ebx
        jle      SHORT G_M7477_IG05
-       align    [0 bytes for IG04]
-						;; size=26 bbWeight=1 PerfScore 6.25
+       align    [10 bytes for IG04]
+						;; size=36 bbWeight=1 PerfScore 6.50
 G_M7477_IG04:
-       movsxd   rsi, edi
+       mov      esi, edi
        mov      rax, r13
        imul     rax, rsi
-       add      rax, r15
+       vmovups  ymm0, ymmword ptr [rax+r15]
        shl      rsi, 5
-       add      rsi, r14
-       vmovdqu  ymm0, ymmword ptr [rax]
-       vmovdqu  ymmword ptr [rsi], ymm0
+       vmovups  ymmword ptr [r14+rsi], ymm0
        inc      edi
        cmp      edi, ebx
        jl       SHORT G_M7477_IG04
-						;; size=34 bbWeight=4 PerfScore 48.00
+						;; size=31 bbWeight=4 PerfScore 46.00
 G_M7477_IG05:
        cmp      byte  ptr [rbp-0x28], 0
        je       SHORT G_M7477_IG07
 						;; size=6 bbWeight=1 PerfScore 3.00
 G_M7477_IG06:
        mov      rdi, gword ptr [rbp-0x30]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=18 bbWeight=0.50 PerfScore 2.25
 G_M7477_IG07:
        nop      
 						;; size=1 bbWeight=1 PerfScore 0.25
 G_M7477_IG08:
+       vzeroupper 
        add      rsp, 32
        pop      rbx
        pop      r13
        pop      r14
        pop      r15
        pop      rbp
        ret      
-						;; size=13 bbWeight=1 PerfScore 3.75
+						;; size=16 bbWeight=1 PerfScore 4.75
 G_M7477_IG09:
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        call     [rax]System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        mov      rdi, rax
        call     CORINFO_HELP_THROW
        int3     
 						;; size=21 bbWeight=0 PerfScore 0.00
 G_M7477_IG10:
        call     CORINFO_HELP_OVERFLOW
        int3     
 						;; size=6 bbWeight=0 PerfScore 0.00
 G_M7477_IG11:
        push     rbp
        push     r15
        push     r14
        push     r13
        push     rbx
        sub      rsp, 16
        mov      rbp, qword ptr [rdi]
        mov      qword ptr [rsp], rbp
        lea      rbp, [rbp+0x40]
 						;; size=23 bbWeight=0 PerfScore 0.00
 G_M7477_IG12:
        cmp      byte  ptr [rbp-0x28], 0
        je       SHORT G_M7477_IG13
        mov      rdi, gword ptr [rbp-0x30]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=24 bbWeight=0 PerfScore 0.00
 G_M7477_IG13:
        nop      
 						;; size=1 bbWeight=0 PerfScore 0.00
 G_M7477_IG14:
+       vzeroupper 
        add      rsp, 16
        pop      rbx
        pop      r13
        pop      r14
        pop      r15
        pop      rbp
        ret      
-						;; size=13 bbWeight=0 PerfScore 0.00
+						;; size=16 bbWeight=0 PerfScore 0.00
 
-; Total bytes of code 294, prolog size 33, PerfScore 92.75, instruction count 92, allocated bytes for code 294 (MethodHash=6e36e2ca) for method System.Runtime.InteropServices.SafeBuffer:ReadSpan[System.Numerics.Vector`1[float]](ulong,System.Span`1[System.Numerics.Vector`1[float]]):this (FullOpts)
+; Total bytes of code 307, prolog size 33, PerfScore 92.00, instruction count 92, allocated bytes for code 307 (MethodHash=6e36e2ca) for method System.Runtime.InteropServices.SafeBuffer:ReadSpan[System.Numerics.Vector`1[float]](ulong,System.Span`1[System.Numerics.Vector`1[float]]):this (FullOpts)
13 (4.42 % of base) - System.Runtime.InteropServices.SafeBuffer:WriteSpan[System.Numerics.Vector`1[float]](ulong,System.ReadOnlySpan`1[System.Numerics.Vector`1[float]]):this
 ; Assembly listing for method System.Runtime.InteropServices.SafeBuffer:WriteSpan[System.Numerics.Vector`1[float]](ulong,System.ReadOnlySpan`1[System.Numerics.Vector`1[float]]):this (FullOpts)
 ; Emitting BLENDED_CODE for X64 with AVX512 - Unix
 ; FullOpts code
 ; optimized code
 ; rbp based frame
 ; fully interruptible
 ; No PGO data
-; 0 inlinees with PGO data; 4 single block inlinees; 1 inlinees without PGO data
+; 0 inlinees with PGO data; 4 single block inlinees; 0 inlinees without PGO data
 ; Final local variable assignments
 ;
 ;  V00 this         [V00,T03] (  8,  6.50)     ref  ->  [rbp-0x30]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
 ;  V01 arg1         [V01,T06] (  3,  3   )    long  ->  r15         single-def
 ;* V02 arg2         [V02    ] (  0,  0   )  struct (16) zero-ref    multireg-arg ld-addr-op single-def <System.ReadOnlySpan`1[System.Numerics.Vector`1[float]]>
 ;  V03 loc0         [V03,T09] (  2,  2   )     int  ->  rax        
 ;  V04 loc1         [V04,T04] (  3,  6   )    long  ->  r15        
 ;  V05 loc2         [V05    ] (  4,  3   )   ubyte  ->  [rbp-0x28]  do-not-enreg[X] addr-exposed ld-addr-op
 ;  V06 loc3         [V06,T07] (  2,  5   )   byref  ->  r14         single-def
 ;  V07 loc4         [V07,T00] (  5, 17   )     int  ->  rdi        
 ;# V08 OutArgs      [V08    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
 ;* V09 tmp1         [V09    ] (  0,  0   )    long  ->  zero-ref    "impAppendStmt"
 ;* V10 tmp2         [V10    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.ReadOnlySpan`1[System.Numerics.Vector`1[float]]>
-;* V11 tmp3         [V11    ] (  0,  0   )   byref  ->  zero-ref    "Inlining Arg"
-;* V12 tmp4         [V12    ] (  0,  0   )   byref  ->  zero-ref    "Inlining Arg"
-;  V13 tmp5         [V13,T08] (  2,  2   )   byref  ->  r14         single-def "field V02._reference (fldOffset=0x0)" P-INDEP
-;  V14 tmp6         [V14,T02] (  4,  7   )     int  ->  rbx         single-def "field V02._length (fldOffset=0x8)" P-INDEP
-;* V15 tmp7         [V15    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V10._reference (fldOffset=0x0)" P-INDEP
-;* V16 tmp8         [V16    ] (  0,  0   )     int  ->  zero-ref    "field V10._length (fldOffset=0x8)" P-INDEP
-;  V17 PSPSym       [V17,T10] (  1,  1   )    long  ->  [rbp-0x40]  do-not-enreg[V] "PSPSym"
-;  V18 cse0         [V18,T05] (  3,  6   )    long  ->  r13         "CSE #01: aggressive"
-;  V19 cse1         [V19,T01] (  3, 12   )    long  ->  rsi         "CSE #02: aggressive"
+;  V11 tmp3         [V11,T08] (  2,  2   )   byref  ->  r14         single-def "field V02._reference (fldOffset=0x0)" P-INDEP
+;  V12 tmp4         [V12,T02] (  4,  7   )     int  ->  rbx         single-def "field V02._length (fldOffset=0x8)" P-INDEP
+;* V13 tmp5         [V13    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V10._reference (fldOffset=0x0)" P-INDEP
+;* V14 tmp6         [V14    ] (  0,  0   )     int  ->  zero-ref    "field V10._length (fldOffset=0x8)" P-INDEP
+;  V15 PSPSym       [V15,T10] (  1,  1   )    long  ->  [rbp-0x40]  do-not-enreg[V] "PSPSym"
+;  V16 cse0         [V16,T05] (  3,  6   )    long  ->  r13         "CSE #01: aggressive"
+;  V17 cse1         [V17,T01] (  3, 12   )    long  ->  rsi         "CSE #02: aggressive"
 ;
 ; Lcl frame size = 32
 
 G_M34876_IG01:
        push     rbp
        push     r15
        push     r14
        push     r13
        push     rbx
        sub      rsp, 32
        lea      rbp, [rsp+0x40]
        mov      qword ptr [rbp-0x40], rsp
        mov      gword ptr [rbp-0x30], rdi
        mov      r15, rsi
        mov      r14, rdx
        mov      ebx, ecx
 						;; size=33 bbWeight=1 PerfScore 8.50
 G_M34876_IG02:
        cmp      qword ptr [rdi+0x18], -1
        je       G_M34876_IG09
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:AlignedSizeOf[System.Numerics.Vector`1[float]]():uint
        call     [rax]System.Runtime.InteropServices.SafeBuffer:AlignedSizeOf[System.Numerics.Vector`1[float]]():uint
        mov      rdi, gword ptr [rbp-0x30]
        add      r15, qword ptr [rdi+0x08]
        mov      r13d, eax
        mov      edx, ebx
        imul     rdx, r13
        jo       G_M34876_IG10
        test     rdx, rdx
        jl       G_M34876_IG10
        mov      rsi, r15
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        xor      esi, esi
        mov      dword ptr [rbp-0x28], esi
 						;; size=75 bbWeight=1 PerfScore 20.75
 G_M34876_IG03:
        lea      rsi, [rbp-0x28]
        mov      rdi, gword ptr [rbp-0x30]
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
        xor      edi, edi
        test     ebx, ebx
        jle      SHORT G_M34876_IG05
-       align    [0 bytes for IG04]
-						;; size=26 bbWeight=1 PerfScore 6.25
+       align    [10 bytes for IG04]
+						;; size=36 bbWeight=1 PerfScore 6.50
 G_M34876_IG04:
-       movsxd   rsi, edi
-       mov      rax, r13
-       imul     rax, rsi
-       add      rax, r15
-       shl      rsi, 5
-       add      rsi, r14
-       vmovdqu  ymm0, ymmword ptr [rsi]
-       vmovdqu  ymmword ptr [rax], ymm0
+       mov      esi, edi
+       mov      rax, rsi
+       shl      rax, 5
+       vmovups  ymm0, ymmword ptr [r14+rax]
+       imul     rsi, r13
+       vmovups  ymmword ptr [rsi+r15], ymm0
        inc      edi
        cmp      edi, ebx
        jl       SHORT G_M34876_IG04
-						;; size=34 bbWeight=4 PerfScore 48.00
+						;; size=31 bbWeight=4 PerfScore 46.00
 G_M34876_IG05:
        cmp      byte  ptr [rbp-0x28], 0
        je       SHORT G_M34876_IG07
 						;; size=6 bbWeight=1 PerfScore 3.00
 G_M34876_IG06:
        mov      rdi, gword ptr [rbp-0x30]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=18 bbWeight=0.50 PerfScore 2.25
 G_M34876_IG07:
        nop      
 						;; size=1 bbWeight=1 PerfScore 0.25
 G_M34876_IG08:
+       vzeroupper 
        add      rsp, 32
        pop      rbx
        pop      r13
        pop      r14
        pop      r15
        pop      rbp
        ret      
-						;; size=13 bbWeight=1 PerfScore 3.75
+						;; size=16 bbWeight=1 PerfScore 4.75
 G_M34876_IG09:
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        call     [rax]System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        mov      rdi, rax
        call     CORINFO_HELP_THROW
        int3     
 						;; size=21 bbWeight=0 PerfScore 0.00
 G_M34876_IG10:
        call     CORINFO_HELP_OVERFLOW
        int3     
 						;; size=6 bbWeight=0 PerfScore 0.00
 G_M34876_IG11:
        push     rbp
        push     r15
        push     r14
        push     r13
        push     rbx
        sub      rsp, 16
        mov      rbp, qword ptr [rdi]
        mov      qword ptr [rsp], rbp
        lea      rbp, [rbp+0x40]
 						;; size=23 bbWeight=0 PerfScore 0.00
 G_M34876_IG12:
        cmp      byte  ptr [rbp-0x28], 0
        je       SHORT G_M34876_IG13
        mov      rdi, gword ptr [rbp-0x30]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=24 bbWeight=0 PerfScore 0.00
 G_M34876_IG13:
        nop      
 						;; size=1 bbWeight=0 PerfScore 0.00
 G_M34876_IG14:
+       vzeroupper 
        add      rsp, 16
        pop      rbx
        pop      r13
        pop      r14
        pop      r15
        pop      rbp
        ret      
-						;; size=13 bbWeight=0 PerfScore 0.00
+						;; size=16 bbWeight=0 PerfScore 0.00
 
-; Total bytes of code 294, prolog size 33, PerfScore 92.75, instruction count 92, allocated bytes for code 294 (MethodHash=fab077c3) for method System.Runtime.InteropServices.SafeBuffer:WriteSpan[System.Numerics.Vector`1[float]](ulong,System.ReadOnlySpan`1[System.Numerics.Vector`1[float]]):this (FullOpts)
+; Total bytes of code 307, prolog size 33, PerfScore 92.00, instruction count 92, allocated bytes for code 307 (MethodHash=fab077c3) for method System.Runtime.InteropServices.SafeBuffer:WriteSpan[System.Numerics.Vector`1[float]](ulong,System.ReadOnlySpan`1[System.Numerics.Vector`1[float]]):this (FullOpts)

@MihuBot
Copy link
Owner Author

MihuBot commented Jul 22, 2024

Top method improvements

-45 (-18.83 % of base) - System.Runtime.InteropServices.SafeBuffer:Read[ubyte](ulong):ubyte:this
 ; Assembly listing for method System.Runtime.InteropServices.SafeBuffer:Read[ubyte](ulong):ubyte:this (FullOpts)
 ; Emitting BLENDED_CODE for X64 with AVX512 - Unix
 ; FullOpts code
 ; optimized code
 ; rbp based frame
 ; fully interruptible
 ; No PGO data
 ; 0 inlinees with PGO data; 3 single block inlinees; 0 inlinees without PGO data
 ; Final local variable assignments
 ;
-;  V00 this         [V00,T00] (  8,  6.50)     ref  ->  [rbp-0x28]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
+;  V00 this         [V00,T00] (  8,  6.50)     ref  ->  [rbp-0x18]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
 ;  V01 arg1         [V01,T01] (  3,  3   )    long  ->  rbx         single-def
-;  V02 loc0         [V02,T02] (  3,  3   )     int  ->  r15        
-;  V03 loc1         [V03,T03] (  3,  3   )    long  ->  rbx        
-;  V04 loc2         [V04    ] (  3,  3   )   ubyte  ->  [rbp-0x18]  do-not-enreg[X] addr-exposed ld-addr-op
-;  V05 loc3         [V05    ] (  4,  3   )   ubyte  ->  [rbp-0x20]  do-not-enreg[X] addr-exposed ld-addr-op
+;  V02 loc0         [V02,T03] (  2,  2   )     int  ->  rax        
+;  V03 loc1         [V03,T02] (  3,  3   )    long  ->  rbx        
+;  V04 loc2         [V04    ] (  4,  3   )   ubyte  ->  [rbp-0x10]  do-not-enreg[X] addr-exposed ld-addr-op
+;  V05 loc3         [V05,T04] (  2,  2   )   ubyte  ->  rbx        
 ;# V06 OutArgs      [V06    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
 ;* V07 tmp1         [V07    ] (  0,  0   )    long  ->  zero-ref    "impAppendStmt"
-;  V08 PSPSym       [V08,T04] (  1,  1   )    long  ->  [rbp-0x30]  do-not-enreg[V] "PSPSym"
+;  V08 PSPSym       [V08,T05] (  1,  1   )    long  ->  [rbp-0x20]  do-not-enreg[V] "PSPSym"
 ;
-; Lcl frame size = 32
+; Lcl frame size = 24
 
 G_M48575_IG01:
        push     rbp
-       push     r15
        push     rbx
-       sub      rsp, 32
-       lea      rbp, [rsp+0x30]
-       mov      qword ptr [rbp-0x30], rsp
-       mov      gword ptr [rbp-0x28], rdi
+       sub      rsp, 24
+       lea      rbp, [rsp+0x20]
+       mov      qword ptr [rbp-0x20], rsp
+       mov      gword ptr [rbp-0x18], rdi
        mov      rbx, rsi
-						;; size=24 bbWeight=1 PerfScore 6.00
+						;; size=22 bbWeight=1 PerfScore 5.00
 G_M48575_IG02:
        cmp      qword ptr [rdi+0x18], -1
-       je       G_M48575_IG08
+       je       SHORT G_M48575_IG08
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SizeOf[ubyte]():uint
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SizeOf[ubyte]():uint
-       mov      r15d, eax
-       mov      rdi, gword ptr [rbp-0x28]
+       mov      rdi, gword ptr [rbp-0x18]
        add      rbx, qword ptr [rdi+0x08]
-       mov      edx, r15d
+       mov      edx, eax
        mov      rsi, rbx
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
-       mov      byte  ptr [rbp-0x18], 0
        xor      esi, esi
-       mov      dword ptr [rbp-0x20], esi
-						;; size=61 bbWeight=1 PerfScore 17.50
+       mov      dword ptr [rbp-0x10], esi
+						;; size=49 bbWeight=1 PerfScore 16.25
 G_M48575_IG03:
-       lea      rsi, [rbp-0x20]
-       mov      rdi, gword ptr [rbp-0x28]
+       lea      rsi, [rbp-0x10]
+       mov      rdi, gword ptr [rbp-0x18]
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
-       mov      edx, r15d
-       lea      rdi, [rbp-0x18]
-       mov      rsi, rbx
-       mov      rax, 0xD1FFAB1E      ; code for System.SpanHelpers:Memmove(byref,byref,ulong)
-       call     [rax]System.SpanHelpers:Memmove(byref,byref,ulong)
-       nop      
-						;; size=43 bbWeight=1 PerfScore 9.25
+       movzx    rbx, byte  ptr [rbx]
+						;; size=23 bbWeight=1 PerfScore 6.75
 G_M48575_IG04:
-       cmp      byte  ptr [rbp-0x20], 0
+       cmp      byte  ptr [rbp-0x10], 0
        je       SHORT G_M48575_IG06
 						;; size=6 bbWeight=1 PerfScore 3.00
 G_M48575_IG05:
-       mov      rdi, gword ptr [rbp-0x28]
+       mov      rdi, gword ptr [rbp-0x18]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=18 bbWeight=0.50 PerfScore 2.25
 G_M48575_IG06:
-       movzx    rax, byte  ptr [rbp-0x18]
-						;; size=4 bbWeight=1 PerfScore 1.00
+       mov      eax, ebx
+						;; size=2 bbWeight=1 PerfScore 0.25
 G_M48575_IG07:
-       add      rsp, 32
+       add      rsp, 24
        pop      rbx
-       pop      r15
        pop      rbp
        ret      
-						;; size=9 bbWeight=1 PerfScore 2.75
+						;; size=7 bbWeight=1 PerfScore 2.25
 G_M48575_IG08:
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        call     [rax]System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        mov      rdi, rax
        call     CORINFO_HELP_THROW
        int3     
 						;; size=21 bbWeight=0 PerfScore 0.00
 G_M48575_IG09:
        push     rbp
-       push     r15
        push     rbx
-       sub      rsp, 16
+       push     rax
        mov      rbp, qword ptr [rdi]
        mov      qword ptr [rsp], rbp
-       lea      rbp, [rbp+0x30]
-						;; size=19 bbWeight=0 PerfScore 0.00
+       lea      rbp, [rbp+0x20]
+						;; size=14 bbWeight=0 PerfScore 0.00
 G_M48575_IG10:
-       cmp      byte  ptr [rbp-0x20], 0
+       cmp      byte  ptr [rbp-0x10], 0
        je       SHORT G_M48575_IG11
-       mov      rdi, gword ptr [rbp-0x28]
+       mov      rdi, gword ptr [rbp-0x18]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=24 bbWeight=0 PerfScore 0.00
 G_M48575_IG11:
        nop      
 						;; size=1 bbWeight=0 PerfScore 0.00
 G_M48575_IG12:
-       add      rsp, 16
+       add      rsp, 8
        pop      rbx
-       pop      r15
        pop      rbp
        ret      
-						;; size=9 bbWeight=0 PerfScore 0.00
+						;; size=7 bbWeight=0 PerfScore 0.00
 
-; Total bytes of code 239, prolog size 24, PerfScore 41.75, instruction count 68, allocated bytes for code 239 (MethodHash=0df04240) for method System.Runtime.InteropServices.SafeBuffer:Read[ubyte](ulong):ubyte:this (FullOpts)
+; Total bytes of code 194, prolog size 22, PerfScore 35.75, instruction count 57, allocated bytes for code 194 (MethodHash=0df04240) for method System.Runtime.InteropServices.SafeBuffer:Read[ubyte](ulong):ubyte:this (FullOpts)
-44 (-18.57 % of base) - System.Runtime.InteropServices.SafeBuffer:Read[int](ulong):int:this
 ; Assembly listing for method System.Runtime.InteropServices.SafeBuffer:Read[int](ulong):int:this (FullOpts)
 ; Emitting BLENDED_CODE for X64 with AVX512 - Unix
 ; FullOpts code
 ; optimized code
 ; rbp based frame
 ; fully interruptible
 ; No PGO data
 ; 0 inlinees with PGO data; 3 single block inlinees; 0 inlinees without PGO data
 ; Final local variable assignments
 ;
-;  V00 this         [V00,T00] (  8,  6.50)     ref  ->  [rbp-0x28]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
+;  V00 this         [V00,T00] (  8,  6.50)     ref  ->  [rbp-0x18]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
 ;  V01 arg1         [V01,T01] (  3,  3   )    long  ->  rbx         single-def
-;  V02 loc0         [V02,T02] (  3,  3   )     int  ->  r15        
-;  V03 loc1         [V03,T03] (  3,  3   )    long  ->  rbx        
-;  V04 loc2         [V04    ] (  3,  3   )     int  ->  [rbp-0x18]  do-not-enreg[X] addr-exposed ld-addr-op
-;  V05 loc3         [V05    ] (  4,  3   )   ubyte  ->  [rbp-0x20]  do-not-enreg[X] addr-exposed ld-addr-op
+;  V02 loc0         [V02,T03] (  2,  2   )     int  ->  rax        
+;  V03 loc1         [V03,T02] (  3,  3   )    long  ->  rbx        
+;  V04 loc2         [V04    ] (  4,  3   )   ubyte  ->  [rbp-0x10]  do-not-enreg[X] addr-exposed ld-addr-op
+;  V05 loc3         [V05,T04] (  2,  2   )     int  ->  rbx        
 ;# V06 OutArgs      [V06    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
 ;* V07 tmp1         [V07    ] (  0,  0   )    long  ->  zero-ref    "impAppendStmt"
-;  V08 PSPSym       [V08,T04] (  1,  1   )    long  ->  [rbp-0x30]  do-not-enreg[V] "PSPSym"
+;  V08 PSPSym       [V08,T05] (  1,  1   )    long  ->  [rbp-0x20]  do-not-enreg[V] "PSPSym"
 ;
-; Lcl frame size = 32
+; Lcl frame size = 24
 
 G_M1215_IG01:
        push     rbp
-       push     r15
        push     rbx
-       sub      rsp, 32
-       lea      rbp, [rsp+0x30]
-       mov      qword ptr [rbp-0x30], rsp
-       mov      gword ptr [rbp-0x28], rdi
+       sub      rsp, 24
+       lea      rbp, [rsp+0x20]
+       mov      qword ptr [rbp-0x20], rsp
+       mov      gword ptr [rbp-0x18], rdi
        mov      rbx, rsi
-						;; size=24 bbWeight=1 PerfScore 6.00
+						;; size=22 bbWeight=1 PerfScore 5.00
 G_M1215_IG02:
        cmp      qword ptr [rdi+0x18], -1
-       je       G_M1215_IG09
+       je       SHORT G_M1215_IG08
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SizeOf[int]():uint
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SizeOf[int]():uint
-       mov      r15d, eax
-       mov      rdi, gword ptr [rbp-0x28]
+       mov      rdi, gword ptr [rbp-0x18]
        add      rbx, qword ptr [rdi+0x08]
-       mov      edx, r15d
+       mov      edx, eax
        mov      rsi, rbx
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        xor      esi, esi
-       mov      dword ptr [rbp-0x18], esi
-						;; size=57 bbWeight=1 PerfScore 16.50
+       mov      dword ptr [rbp-0x10], esi
+						;; size=49 bbWeight=1 PerfScore 16.25
 G_M1215_IG03:
-       mov      dword ptr [rbp-0x20], esi
-						;; size=3 bbWeight=1 PerfScore 1.00
-G_M1215_IG04:
-       lea      rsi, [rbp-0x20]
-       mov      rdi, gword ptr [rbp-0x28]
+       lea      rsi, [rbp-0x10]
+       mov      rdi, gword ptr [rbp-0x18]
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
-       mov      edx, r15d
-       lea      rdi, [rbp-0x18]
-       mov      rsi, rbx
-       mov      rax, 0xD1FFAB1E      ; code for System.SpanHelpers:Memmove(byref,byref,ulong)
-       call     [rax]System.SpanHelpers:Memmove(byref,byref,ulong)
-       nop      
-						;; size=43 bbWeight=1 PerfScore 9.25
-G_M1215_IG05:
-       cmp      byte  ptr [rbp-0x20], 0
-       je       SHORT G_M1215_IG07
+       mov      ebx, dword ptr [rbx]
+						;; size=22 bbWeight=1 PerfScore 6.75
+G_M1215_IG04:
+       cmp      byte  ptr [rbp-0x10], 0
+       je       SHORT G_M1215_IG06
 						;; size=6 bbWeight=1 PerfScore 3.00
-G_M1215_IG06:
-       mov      rdi, gword ptr [rbp-0x28]
+G_M1215_IG05:
+       mov      rdi, gword ptr [rbp-0x18]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=18 bbWeight=0.50 PerfScore 2.25
+G_M1215_IG06:
+       mov      eax, ebx
+						;; size=2 bbWeight=1 PerfScore 0.25
 G_M1215_IG07:
-       mov      eax, dword ptr [rbp-0x18]
-						;; size=3 bbWeight=1 PerfScore 1.00
-G_M1215_IG08:
-       add      rsp, 32
+       add      rsp, 24
        pop      rbx
-       pop      r15
        pop      rbp
        ret      
-						;; size=9 bbWeight=1 PerfScore 2.75
-G_M1215_IG09:
+						;; size=7 bbWeight=1 PerfScore 2.25
+G_M1215_IG08:
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        call     [rax]System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        mov      rdi, rax
        call     CORINFO_HELP_THROW
        int3     
 						;; size=21 bbWeight=0 PerfScore 0.00
-G_M1215_IG10:
+G_M1215_IG09:
        push     rbp
-       push     r15
        push     rbx
-       sub      rsp, 16
+       push     rax
        mov      rbp, qword ptr [rdi]
        mov      qword ptr [rsp], rbp
-       lea      rbp, [rbp+0x30]
-						;; size=19 bbWeight=0 PerfScore 0.00
-G_M1215_IG11:
-       cmp      byte  ptr [rbp-0x20], 0
-       je       SHORT G_M1215_IG12
-       mov      rdi, gword ptr [rbp-0x28]
+       lea      rbp, [rbp+0x20]
+						;; size=14 bbWeight=0 PerfScore 0.00
+G_M1215_IG10:
+       cmp      byte  ptr [rbp-0x10], 0
+       je       SHORT G_M1215_IG11
+       mov      rdi, gword ptr [rbp-0x18]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=24 bbWeight=0 PerfScore 0.00
-G_M1215_IG12:
+G_M1215_IG11:
        nop      
 						;; size=1 bbWeight=0 PerfScore 0.00
-G_M1215_IG13:
-       add      rsp, 16
+G_M1215_IG12:
+       add      rsp, 8
        pop      rbx
-       pop      r15
        pop      rbp
        ret      
-						;; size=9 bbWeight=0 PerfScore 0.00
+						;; size=7 bbWeight=0 PerfScore 0.00
 
-; Total bytes of code 237, prolog size 24, PerfScore 41.75, instruction count 68, allocated bytes for code 237 (MethodHash=84fefb40) for method System.Runtime.InteropServices.SafeBuffer:Read[int](ulong):int:this (FullOpts)
+; Total bytes of code 193, prolog size 22, PerfScore 35.75, instruction count 57, allocated bytes for code 193 (MethodHash=84fefb40) for method System.Runtime.InteropServices.SafeBuffer:Read[int](ulong):int:this (FullOpts)
-44 (-18.41 % of base) - System.Runtime.InteropServices.SafeBuffer:Read[long](ulong):long:this
 ; Assembly listing for method System.Runtime.InteropServices.SafeBuffer:Read[long](ulong):long:this (FullOpts)
 ; Emitting BLENDED_CODE for X64 with AVX512 - Unix
 ; FullOpts code
 ; optimized code
 ; rbp based frame
 ; fully interruptible
 ; No PGO data
 ; 0 inlinees with PGO data; 3 single block inlinees; 0 inlinees without PGO data
 ; Final local variable assignments
 ;
-;  V00 this         [V00,T00] (  8,  6.50)     ref  ->  [rbp-0x28]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
+;  V00 this         [V00,T00] (  8,  6.50)     ref  ->  [rbp-0x18]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
 ;  V01 arg1         [V01,T01] (  3,  3   )    long  ->  rbx         single-def
-;  V02 loc0         [V02,T02] (  3,  3   )     int  ->  r15        
-;  V03 loc1         [V03,T03] (  3,  3   )    long  ->  rbx        
-;  V04 loc2         [V04    ] (  3,  3   )    long  ->  [rbp-0x18]  do-not-enreg[X] addr-exposed ld-addr-op
-;  V05 loc3         [V05    ] (  4,  3   )   ubyte  ->  [rbp-0x20]  do-not-enreg[X] addr-exposed ld-addr-op
+;  V02 loc0         [V02,T03] (  2,  2   )     int  ->  rax        
+;  V03 loc1         [V03,T02] (  3,  3   )    long  ->  rbx        
+;  V04 loc2         [V04    ] (  4,  3   )   ubyte  ->  [rbp-0x10]  do-not-enreg[X] addr-exposed ld-addr-op
+;  V05 loc3         [V05,T04] (  2,  2   )    long  ->  rbx        
 ;# V06 OutArgs      [V06    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
 ;* V07 tmp1         [V07    ] (  0,  0   )    long  ->  zero-ref    "impAppendStmt"
-;  V08 PSPSym       [V08,T04] (  1,  1   )    long  ->  [rbp-0x30]  do-not-enreg[V] "PSPSym"
+;  V08 PSPSym       [V08,T05] (  1,  1   )    long  ->  [rbp-0x20]  do-not-enreg[V] "PSPSym"
 ;
-; Lcl frame size = 32
+; Lcl frame size = 24
 
 G_M44191_IG01:
        push     rbp
-       push     r15
        push     rbx
-       sub      rsp, 32
-       lea      rbp, [rsp+0x30]
-       mov      qword ptr [rbp-0x30], rsp
-       mov      gword ptr [rbp-0x28], rdi
+       sub      rsp, 24
+       lea      rbp, [rsp+0x20]
+       mov      qword ptr [rbp-0x20], rsp
+       mov      gword ptr [rbp-0x18], rdi
        mov      rbx, rsi
-						;; size=24 bbWeight=1 PerfScore 6.00
+						;; size=22 bbWeight=1 PerfScore 5.00
 G_M44191_IG02:
        cmp      qword ptr [rdi+0x18], -1
-       je       G_M44191_IG09
+       je       SHORT G_M44191_IG08
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SizeOf[long]():uint
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SizeOf[long]():uint
-       mov      r15d, eax
-       mov      rdi, gword ptr [rbp-0x28]
+       mov      rdi, gword ptr [rbp-0x18]
        add      rbx, qword ptr [rdi+0x08]
-       mov      edx, r15d
+       mov      edx, eax
        mov      rsi, rbx
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        xor      esi, esi
-       mov      qword ptr [rbp-0x18], rsi
-						;; size=58 bbWeight=1 PerfScore 16.50
+       mov      dword ptr [rbp-0x10], esi
+						;; size=49 bbWeight=1 PerfScore 16.25
 G_M44191_IG03:
-       mov      dword ptr [rbp-0x20], esi
-						;; size=3 bbWeight=1 PerfScore 1.00
-G_M44191_IG04:
-       lea      rsi, [rbp-0x20]
-       mov      rdi, gword ptr [rbp-0x28]
+       lea      rsi, [rbp-0x10]
+       mov      rdi, gword ptr [rbp-0x18]
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
-       mov      edx, r15d
-       lea      rdi, [rbp-0x18]
-       mov      rsi, rbx
-       mov      rax, 0xD1FFAB1E      ; code for System.SpanHelpers:Memmove(byref,byref,ulong)
-       call     [rax]System.SpanHelpers:Memmove(byref,byref,ulong)
-       nop      
-						;; size=43 bbWeight=1 PerfScore 9.25
-G_M44191_IG05:
-       cmp      byte  ptr [rbp-0x20], 0
-       je       SHORT G_M44191_IG07
+       mov      rbx, qword ptr [rbx]
+						;; size=23 bbWeight=1 PerfScore 6.75
+G_M44191_IG04:
+       cmp      byte  ptr [rbp-0x10], 0
+       je       SHORT G_M44191_IG06
 						;; size=6 bbWeight=1 PerfScore 3.00
-G_M44191_IG06:
-       mov      rdi, gword ptr [rbp-0x28]
+G_M44191_IG05:
+       mov      rdi, gword ptr [rbp-0x18]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=18 bbWeight=0.50 PerfScore 2.25
+G_M44191_IG06:
+       mov      rax, rbx
+						;; size=3 bbWeight=1 PerfScore 0.25
 G_M44191_IG07:
-       mov      rax, qword ptr [rbp-0x18]
-						;; size=4 bbWeight=1 PerfScore 1.00
-G_M44191_IG08:
-       add      rsp, 32
+       add      rsp, 24
        pop      rbx
-       pop      r15
        pop      rbp
        ret      
-						;; size=9 bbWeight=1 PerfScore 2.75
-G_M44191_IG09:
+						;; size=7 bbWeight=1 PerfScore 2.25
+G_M44191_IG08:
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        call     [rax]System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        mov      rdi, rax
        call     CORINFO_HELP_THROW
        int3     
 						;; size=21 bbWeight=0 PerfScore 0.00
-G_M44191_IG10:
+G_M44191_IG09:
        push     rbp
-       push     r15
        push     rbx
-       sub      rsp, 16
+       push     rax
        mov      rbp, qword ptr [rdi]
        mov      qword ptr [rsp], rbp
-       lea      rbp, [rbp+0x30]
-						;; size=19 bbWeight=0 PerfScore 0.00
-G_M44191_IG11:
-       cmp      byte  ptr [rbp-0x20], 0
-       je       SHORT G_M44191_IG12
-       mov      rdi, gword ptr [rbp-0x28]
+       lea      rbp, [rbp+0x20]
+						;; size=14 bbWeight=0 PerfScore 0.00
+G_M44191_IG10:
+       cmp      byte  ptr [rbp-0x10], 0
+       je       SHORT G_M44191_IG11
+       mov      rdi, gword ptr [rbp-0x18]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=24 bbWeight=0 PerfScore 0.00
-G_M44191_IG12:
+G_M44191_IG11:
        nop      
 						;; size=1 bbWeight=0 PerfScore 0.00
-G_M44191_IG13:
-       add      rsp, 16
+G_M44191_IG12:
+       add      rsp, 8
        pop      rbx
-       pop      r15
        pop      rbp
        ret      
-						;; size=9 bbWeight=0 PerfScore 0.00
+						;; size=7 bbWeight=0 PerfScore 0.00
 
-; Total bytes of code 239, prolog size 24, PerfScore 41.75, instruction count 68, allocated bytes for code 239 (MethodHash=99115360) for method System.Runtime.InteropServices.SafeBuffer:Read[long](ulong):long:this (FullOpts)
+; Total bytes of code 195, prolog size 22, PerfScore 35.75, instruction count 57, allocated bytes for code 195 (MethodHash=99115360) for method System.Runtime.InteropServices.SafeBuffer:Read[long](ulong):long:this (FullOpts)
-44 (-18.41 % of base) - System.Runtime.InteropServices.SafeBuffer:Read[short](ulong):short:this
 ; Assembly listing for method System.Runtime.InteropServices.SafeBuffer:Read[short](ulong):short:this (FullOpts)
 ; Emitting BLENDED_CODE for X64 with AVX512 - Unix
 ; FullOpts code
 ; optimized code
 ; rbp based frame
 ; fully interruptible
 ; No PGO data
 ; 0 inlinees with PGO data; 3 single block inlinees; 0 inlinees without PGO data
 ; Final local variable assignments
 ;
-;  V00 this         [V00,T00] (  8,  6.50)     ref  ->  [rbp-0x28]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
+;  V00 this         [V00,T00] (  8,  6.50)     ref  ->  [rbp-0x18]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
 ;  V01 arg1         [V01,T01] (  3,  3   )    long  ->  rbx         single-def
-;  V02 loc0         [V02,T02] (  3,  3   )     int  ->  r15        
-;  V03 loc1         [V03,T03] (  3,  3   )    long  ->  rbx        
-;  V04 loc2         [V04    ] (  3,  3   )   short  ->  [rbp-0x18]  do-not-enreg[X] addr-exposed ld-addr-op
-;  V05 loc3         [V05    ] (  4,  3   )   ubyte  ->  [rbp-0x20]  do-not-enreg[X] addr-exposed ld-addr-op
+;  V02 loc0         [V02,T03] (  2,  2   )     int  ->  rax        
+;  V03 loc1         [V03,T02] (  3,  3   )    long  ->  rbx        
+;  V04 loc2         [V04    ] (  4,  3   )   ubyte  ->  [rbp-0x10]  do-not-enreg[X] addr-exposed ld-addr-op
+;  V05 loc3         [V05,T04] (  2,  2   )   short  ->  rbx        
 ;# V06 OutArgs      [V06    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
 ;* V07 tmp1         [V07    ] (  0,  0   )    long  ->  zero-ref    "impAppendStmt"
-;  V08 PSPSym       [V08,T04] (  1,  1   )    long  ->  [rbp-0x30]  do-not-enreg[V] "PSPSym"
+;  V08 PSPSym       [V08,T05] (  1,  1   )    long  ->  [rbp-0x20]  do-not-enreg[V] "PSPSym"
 ;
-; Lcl frame size = 32
+; Lcl frame size = 24
 
 G_M14975_IG01:
        push     rbp
-       push     r15
        push     rbx
-       sub      rsp, 32
-       lea      rbp, [rsp+0x30]
-       mov      qword ptr [rbp-0x30], rsp
-       mov      gword ptr [rbp-0x28], rdi
+       sub      rsp, 24
+       lea      rbp, [rsp+0x20]
+       mov      qword ptr [rbp-0x20], rsp
+       mov      gword ptr [rbp-0x18], rdi
        mov      rbx, rsi
-						;; size=24 bbWeight=1 PerfScore 6.00
+						;; size=22 bbWeight=1 PerfScore 5.00
 G_M14975_IG02:
        cmp      qword ptr [rdi+0x18], -1
-       je       G_M14975_IG09
+       je       SHORT G_M14975_IG08
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SizeOf[short]():uint
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SizeOf[short]():uint
-       mov      r15d, eax
-       mov      rdi, gword ptr [rbp-0x28]
+       mov      rdi, gword ptr [rbp-0x18]
        add      rbx, qword ptr [rdi+0x08]
-       mov      edx, r15d
+       mov      edx, eax
        mov      rsi, rbx
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        xor      esi, esi
-       mov      dword ptr [rbp-0x18], esi
-						;; size=57 bbWeight=1 PerfScore 16.50
+       mov      dword ptr [rbp-0x10], esi
+						;; size=49 bbWeight=1 PerfScore 16.25
 G_M14975_IG03:
-       mov      dword ptr [rbp-0x20], esi
-						;; size=3 bbWeight=1 PerfScore 1.00
-G_M14975_IG04:
-       lea      rsi, [rbp-0x20]
-       mov      rdi, gword ptr [rbp-0x28]
+       lea      rsi, [rbp-0x10]
+       mov      rdi, gword ptr [rbp-0x18]
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
-       mov      edx, r15d
-       lea      rdi, [rbp-0x18]
-       mov      rsi, rbx
-       mov      rax, 0xD1FFAB1E      ; code for System.SpanHelpers:Memmove(byref,byref,ulong)
-       call     [rax]System.SpanHelpers:Memmove(byref,byref,ulong)
-       nop      
-						;; size=43 bbWeight=1 PerfScore 9.25
-G_M14975_IG05:
-       cmp      byte  ptr [rbp-0x20], 0
-       je       SHORT G_M14975_IG07
+       movsx    rbx, word  ptr [rbx]
+						;; size=24 bbWeight=1 PerfScore 8.75
+G_M14975_IG04:
+       cmp      byte  ptr [rbp-0x10], 0
+       je       SHORT G_M14975_IG06
 						;; size=6 bbWeight=1 PerfScore 3.00
-G_M14975_IG06:
-       mov      rdi, gword ptr [rbp-0x28]
+G_M14975_IG05:
+       mov      rdi, gword ptr [rbp-0x18]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=18 bbWeight=0.50 PerfScore 2.25
+G_M14975_IG06:
+       mov      eax, ebx
+						;; size=2 bbWeight=1 PerfScore 0.25
 G_M14975_IG07:
-       movsx    rax, word  ptr [rbp-0x18]
-						;; size=5 bbWeight=1 PerfScore 3.00
-G_M14975_IG08:
-       add      rsp, 32
+       add      rsp, 24
        pop      rbx
-       pop      r15
        pop      rbp
        ret      
-						;; size=9 bbWeight=1 PerfScore 2.75
-G_M14975_IG09:
+						;; size=7 bbWeight=1 PerfScore 2.25
+G_M14975_IG08:
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        call     [rax]System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        mov      rdi, rax
        call     CORINFO_HELP_THROW
        int3     
 						;; size=21 bbWeight=0 PerfScore 0.00
-G_M14975_IG10:
+G_M14975_IG09:
        push     rbp
-       push     r15
        push     rbx
-       sub      rsp, 16
+       push     rax
        mov      rbp, qword ptr [rdi]
        mov      qword ptr [rsp], rbp
-       lea      rbp, [rbp+0x30]
-						;; size=19 bbWeight=0 PerfScore 0.00
-G_M14975_IG11:
-       cmp      byte  ptr [rbp-0x20], 0
-       je       SHORT G_M14975_IG12
-       mov      rdi, gword ptr [rbp-0x28]
+       lea      rbp, [rbp+0x20]
+						;; size=14 bbWeight=0 PerfScore 0.00
+G_M14975_IG10:
+       cmp      byte  ptr [rbp-0x10], 0
+       je       SHORT G_M14975_IG11
+       mov      rdi, gword ptr [rbp-0x18]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=24 bbWeight=0 PerfScore 0.00
-G_M14975_IG12:
+G_M14975_IG11:
        nop      
 						;; size=1 bbWeight=0 PerfScore 0.00
-G_M14975_IG13:
-       add      rsp, 16
+G_M14975_IG12:
+       add      rsp, 8
        pop      rbx
-       pop      r15
        pop      rbp
        ret      
-						;; size=9 bbWeight=0 PerfScore 0.00
+						;; size=7 bbWeight=0 PerfScore 0.00
 
-; Total bytes of code 239, prolog size 24, PerfScore 43.75, instruction count 68, allocated bytes for code 239 (MethodHash=291bc580) for method System.Runtime.InteropServices.SafeBuffer:Read[short](ulong):short:this (FullOpts)
+; Total bytes of code 195, prolog size 22, PerfScore 37.75, instruction count 57, allocated bytes for code 195 (MethodHash=291bc580) for method System.Runtime.InteropServices.SafeBuffer:Read[short](ulong):short:this (FullOpts)
-37 (-15.42 % of base) - System.Runtime.InteropServices.SafeBuffer:Read[double](ulong):double:this
 ; Assembly listing for method System.Runtime.InteropServices.SafeBuffer:Read[double](ulong):double:this (FullOpts)
 ; Emitting BLENDED_CODE for X64 with AVX512 - Unix
 ; FullOpts code
 ; optimized code
 ; rbp based frame
 ; fully interruptible
 ; No PGO data
 ; 0 inlinees with PGO data; 3 single block inlinees; 0 inlinees without PGO data
 ; Final local variable assignments
 ;
-;  V00 this         [V00,T00] (  8,  6.50)     ref  ->  [rbp-0x28]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
+;  V00 this         [V00,T00] (  8,  6.50)     ref  ->  [rbp-0x20]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
 ;  V01 arg1         [V01,T01] (  3,  3   )    long  ->  rbx         single-def
-;  V02 loc0         [V02,T02] (  3,  3   )     int  ->  r15        
-;  V03 loc1         [V03,T03] (  3,  3   )    long  ->  rbx        
-;  V04 loc2         [V04    ] (  3,  3   )  double  ->  [rbp-0x18]  do-not-enreg[X] addr-exposed ld-addr-op
-;  V05 loc3         [V05    ] (  4,  3   )   ubyte  ->  [rbp-0x20]  do-not-enreg[X] addr-exposed ld-addr-op
+;  V02 loc0         [V02,T03] (  2,  2   )     int  ->  rax        
+;  V03 loc1         [V03,T02] (  3,  3   )    long  ->  rbx        
+;  V04 loc2         [V04    ] (  4,  3   )   ubyte  ->  [rbp-0x10]  do-not-enreg[X] addr-exposed ld-addr-op
+;  V05 loc3         [V05,T05] (  2,  2   )  double  ->  [rbp-0x18]  spill-single-def
 ;# V06 OutArgs      [V06    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
 ;* V07 tmp1         [V07    ] (  0,  0   )    long  ->  zero-ref    "impAppendStmt"
 ;  V08 PSPSym       [V08,T04] (  1,  1   )    long  ->  [rbp-0x30]  do-not-enreg[V] "PSPSym"
 ;
-; Lcl frame size = 32
+; Lcl frame size = 40
 
 G_M25535_IG01:
        push     rbp
-       push     r15
        push     rbx
-       sub      rsp, 32
+       sub      rsp, 40
        lea      rbp, [rsp+0x30]
        mov      qword ptr [rbp-0x30], rsp
-       mov      gword ptr [rbp-0x28], rdi
+       mov      gword ptr [rbp-0x20], rdi
        mov      rbx, rsi
-						;; size=24 bbWeight=1 PerfScore 6.00
+						;; size=22 bbWeight=1 PerfScore 5.00
 G_M25535_IG02:
        cmp      qword ptr [rdi+0x18], -1
-       je       G_M25535_IG09
+       je       SHORT G_M25535_IG08
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SizeOf[double]():uint
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SizeOf[double]():uint
-       mov      r15d, eax
-       mov      rdi, gword ptr [rbp-0x28]
+       mov      rdi, gword ptr [rbp-0x20]
        add      rbx, qword ptr [rdi+0x08]
-       mov      edx, r15d
+       mov      edx, eax
        mov      rsi, rbx
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        xor      esi, esi
-       mov      qword ptr [rbp-0x18], rsi
-						;; size=58 bbWeight=1 PerfScore 16.50
+       mov      dword ptr [rbp-0x10], esi
+						;; size=49 bbWeight=1 PerfScore 16.25
 G_M25535_IG03:
-       mov      dword ptr [rbp-0x20], esi
-						;; size=3 bbWeight=1 PerfScore 1.00
-G_M25535_IG04:
-       lea      rsi, [rbp-0x20]
-       mov      rdi, gword ptr [rbp-0x28]
+       lea      rsi, [rbp-0x10]
+       mov      rdi, gword ptr [rbp-0x20]
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
-       mov      edx, r15d
-       lea      rdi, [rbp-0x18]
-       mov      rsi, rbx
-       mov      rax, 0xD1FFAB1E      ; code for System.SpanHelpers:Memmove(byref,byref,ulong)
-       call     [rax]System.SpanHelpers:Memmove(byref,byref,ulong)
-       nop      
-						;; size=43 bbWeight=1 PerfScore 9.25
-G_M25535_IG05:
-       cmp      byte  ptr [rbp-0x20], 0
-       je       SHORT G_M25535_IG07
+       vmovsd   xmm0, qword ptr [rbx]
+       vmovsd   qword ptr [rbp-0x18], xmm0
+						;; size=29 bbWeight=1 PerfScore 9.75
+G_M25535_IG04:
+       cmp      byte  ptr [rbp-0x10], 0
+       je       SHORT G_M25535_IG06
 						;; size=6 bbWeight=1 PerfScore 3.00
-G_M25535_IG06:
-       mov      rdi, gword ptr [rbp-0x28]
+G_M25535_IG05:
+       mov      rdi, gword ptr [rbp-0x20]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=18 bbWeight=0.50 PerfScore 2.25
-G_M25535_IG07:
+G_M25535_IG06:
        vmovsd   xmm0, qword ptr [rbp-0x18]
 						;; size=5 bbWeight=1 PerfScore 3.00
-G_M25535_IG08:
-       add      rsp, 32
+G_M25535_IG07:
+       add      rsp, 40
        pop      rbx
-       pop      r15
        pop      rbp
        ret      
-						;; size=9 bbWeight=1 PerfScore 2.75
-G_M25535_IG09:
+						;; size=7 bbWeight=1 PerfScore 2.25
+G_M25535_IG08:
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        call     [rax]System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        mov      rdi, rax
        call     CORINFO_HELP_THROW
        int3     
 						;; size=21 bbWeight=0 PerfScore 0.00
-G_M25535_IG10:
+G_M25535_IG09:
        push     rbp
-       push     r15
        push     rbx
-       sub      rsp, 16
+       push     rax
        mov      rbp, qword ptr [rdi]
        mov      qword ptr [rsp], rbp
        lea      rbp, [rbp+0x30]
-						;; size=19 bbWeight=0 PerfScore 0.00
-G_M25535_IG11:
-       cmp      byte  ptr [rbp-0x20], 0
-       je       SHORT G_M25535_IG12
-       mov      rdi, gword ptr [rbp-0x28]
+						;; size=14 bbWeight=0 PerfScore 0.00
+G_M25535_IG10:
+       cmp      byte  ptr [rbp-0x10], 0
+       je       SHORT G_M25535_IG11
+       mov      rdi, gword ptr [rbp-0x20]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=24 bbWeight=0 PerfScore 0.00
-G_M25535_IG12:
+G_M25535_IG11:
        nop      
 						;; size=1 bbWeight=0 PerfScore 0.00
-G_M25535_IG13:
-       add      rsp, 16
+G_M25535_IG12:
+       add      rsp, 8
        pop      rbx
-       pop      r15
        pop      rbp
        ret      
-						;; size=9 bbWeight=0 PerfScore 0.00
+						;; size=7 bbWeight=0 PerfScore 0.00
 
-; Total bytes of code 240, prolog size 24, PerfScore 43.75, instruction count 68, allocated bytes for code 240 (MethodHash=da8b9c40) for method System.Runtime.InteropServices.SafeBuffer:Read[double](ulong):double:this (FullOpts)
+; Total bytes of code 203, prolog size 22, PerfScore 41.50, instruction count 58, allocated bytes for code 203 (MethodHash=da8b9c40) for method System.Runtime.InteropServices.SafeBuffer:Read[double](ulong):double:this (FullOpts)
-35 (-13.16 % of base) - System.Runtime.InteropServices.SafeBuffer:Read[System.Numerics.Vector`1[float]](ulong):System.Numerics.Vector`1[float]:this
 ; Assembly listing for method System.Runtime.InteropServices.SafeBuffer:Read[System.Numerics.Vector`1[float]](ulong):System.Numerics.Vector`1[float]:this (FullOpts)
 ; Emitting BLENDED_CODE for X64 with AVX512 - Unix
 ; FullOpts code
 ; optimized code
 ; rbp based frame
 ; fully interruptible
 ; No PGO data
 ; 0 inlinees with PGO data; 3 single block inlinees; 0 inlinees without PGO data
 ; Final local variable assignments
 ;
-;  V00 this         [V00,T00] (  8,  6.50)     ref  ->  [rbp-0x60]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
+;  V00 this         [V00,T00] (  8,  6.50)     ref  ->  [rbp-0x58]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
 ;  V01 RetBuf       [V01,T01] (  4,  4   )   byref  ->  rbx         single-def
 ;  V02 arg1         [V02,T02] (  3,  3   )    long  ->  r15         single-def
-;  V03 loc0         [V03,T03] (  3,  3   )     int  ->  r14        
-;  V04 loc1         [V04,T04] (  3,  3   )    long  ->  r15        
-;  V05 loc2         [V05    ] (  3,  3   )  simd32  ->  [rbp-0x50]  do-not-enreg[XS] addr-exposed ld-addr-op <System.Numerics.Vector`1[float]>
-;  V06 loc3         [V06    ] (  4,  3   )   ubyte  ->  [rbp-0x58]  do-not-enreg[X] addr-exposed ld-addr-op
+;  V03 loc0         [V03,T04] (  2,  2   )     int  ->  rax        
+;  V04 loc1         [V04,T03] (  3,  3   )    long  ->  r15        
+;  V05 loc2         [V05    ] (  4,  3   )   ubyte  ->  [rbp-0x18]  do-not-enreg[X] addr-exposed ld-addr-op
+;  V06 loc3         [V06,T06] (  2,  2   )  simd32  ->  [rbp-0x50]  spill-single-def <System.Numerics.Vector`1[float]>
 ;# V07 OutArgs      [V07    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
 ;* V08 tmp1         [V08    ] (  0,  0   )    long  ->  zero-ref    "impAppendStmt"
-;  V09 PSPSym       [V09,T05] (  1,  1   )    long  ->  [rbp-0x70]  do-not-enreg[V] "PSPSym"
+;  V09 PSPSym       [V09,T05] (  1,  1   )    long  ->  [rbp-0x60]  do-not-enreg[V] "PSPSym"
 ;
-; Lcl frame size = 88
+; Lcl frame size = 80
 
 G_M13951_IG01:
        push     rbp
        push     r15
-       push     r14
        push     rbx
-       sub      rsp, 88
-       lea      rbp, [rsp+0x70]
-       mov      qword ptr [rbp-0x70], rsp
-       mov      gword ptr [rbp-0x60], rdi
+       sub      rsp, 80
+       lea      rbp, [rsp+0x60]
+       mov      qword ptr [rbp-0x60], rsp
+       mov      gword ptr [rbp-0x58], rdi
        mov      rbx, rsi
        mov      r15, rdx
-						;; size=29 bbWeight=1 PerfScore 7.25
+						;; size=27 bbWeight=1 PerfScore 6.25
 G_M13951_IG02:
        cmp      qword ptr [rdi+0x18], -1
-       je       G_M13951_IG08
+       je       SHORT G_M13951_IG08
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SizeOf[System.Numerics.Vector`1[float]]():uint
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SizeOf[System.Numerics.Vector`1[float]]():uint
-       mov      r14d, eax
-       mov      rdi, gword ptr [rbp-0x60]
+       mov      rdi, gword ptr [rbp-0x58]
        add      r15, qword ptr [rdi+0x08]
-       mov      edx, r14d
+       mov      edx, eax
        mov      rsi, r15
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
-       vxorps   ymm0, ymm0, ymm0
-       vmovups  ymmword ptr [rbp-0x50], ymm0
        xor      esi, esi
-       mov      dword ptr [rbp-0x58], esi
-						;; size=66 bbWeight=1 PerfScore 17.83
+       mov      dword ptr [rbp-0x18], esi
+						;; size=49 bbWeight=1 PerfScore 16.25
 G_M13951_IG03:
-       lea      rsi, [rbp-0x58]
-       mov      rdi, gword ptr [rbp-0x60]
+       lea      rsi, [rbp-0x18]
+       mov      rdi, gword ptr [rbp-0x58]
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
-       mov      edx, r14d
-       lea      rdi, [rbp-0x50]
-       mov      rsi, r15
-       mov      rax, 0xD1FFAB1E      ; code for System.SpanHelpers:Memmove(byref,byref,ulong)
-       call     [rax]System.SpanHelpers:Memmove(byref,byref,ulong)
-       nop      
-						;; size=43 bbWeight=1 PerfScore 9.25
+       vmovups  ymm0, ymmword ptr [r15]
+       vmovups  ymmword ptr [rbp-0x50], ymm0
+						;; size=30 bbWeight=1 PerfScore 10.75
 G_M13951_IG04:
-       cmp      byte  ptr [rbp-0x58], 0
+       cmp      byte  ptr [rbp-0x18], 0
        je       SHORT G_M13951_IG06
 						;; size=6 bbWeight=1 PerfScore 3.00
 G_M13951_IG05:
-       mov      rdi, gword ptr [rbp-0x60]
+       mov      rdi, gword ptr [rbp-0x58]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=18 bbWeight=0.50 PerfScore 2.25
 G_M13951_IG06:
        vmovups  ymm0, ymmword ptr [rbp-0x50]
        vmovups  ymmword ptr [rbx], ymm0
        mov      rax, rbx
 						;; size=12 bbWeight=1 PerfScore 6.25
 G_M13951_IG07:
        vzeroupper 
-       add      rsp, 88
+       add      rsp, 80
        pop      rbx
-       pop      r14
        pop      r15
        pop      rbp
        ret      
-						;; size=14 bbWeight=1 PerfScore 4.25
+						;; size=12 bbWeight=1 PerfScore 3.75
 G_M13951_IG08:
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        call     [rax]System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        mov      rdi, rax
        call     CORINFO_HELP_THROW
        int3     
 						;; size=21 bbWeight=0 PerfScore 0.00
 G_M13951_IG09:
        push     rbp
        push     r15
-       push     r14
        push     rbx
-       push     rax
+       sub      rsp, 16
        mov      rbp, qword ptr [rdi]
        mov      qword ptr [rsp], rbp
-       lea      rbp, [rbp+0x70]
-						;; size=18 bbWeight=0 PerfScore 0.00
+       lea      rbp, [rbp+0x60]
+						;; size=19 bbWeight=0 PerfScore 0.00
 G_M13951_IG10:
-       cmp      byte  ptr [rbp-0x58], 0
+       cmp      byte  ptr [rbp-0x18], 0
        je       SHORT G_M13951_IG11
-       mov      rdi, gword ptr [rbp-0x60]
+       mov      rdi, gword ptr [rbp-0x58]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=24 bbWeight=0 PerfScore 0.00
 G_M13951_IG11:
        nop      
 						;; size=1 bbWeight=0 PerfScore 0.00
 G_M13951_IG12:
        vzeroupper 
-       add      rsp, 8
+       add      rsp, 16
        pop      rbx
-       pop      r14
        pop      r15
        pop      rbp
        ret      
-						;; size=14 bbWeight=0 PerfScore 0.00
+						;; size=12 bbWeight=0 PerfScore 0.00
 
-; Total bytes of code 266, prolog size 29, PerfScore 50.08, instruction count 78, allocated bytes for code 266 (MethodHash=990ac980) for method System.Runtime.InteropServices.SafeBuffer:Read[System.Numerics.Vector`1[float]](ulong):System.Numerics.Vector`1[float]:this (FullOpts)
+; Total bytes of code 231, prolog size 27, PerfScore 48.50, instruction count 67, allocated bytes for code 231 (MethodHash=990ac980) for method System.Runtime.InteropServices.SafeBuffer:Read[System.Numerics.Vector`1[float]](ulong):System.Numerics.Vector`1[float]:this (FullOpts)
-29 (-12.45 % of base) - System.Runtime.InteropServices.SafeBuffer:Write[double](ulong,double):this
 ; Assembly listing for method System.Runtime.InteropServices.SafeBuffer:Write[double](ulong,double):this (FullOpts)
 ; Emitting BLENDED_CODE for X64 with AVX512 - Unix
 ; FullOpts code
 ; optimized code
 ; rbp based frame
 ; fully interruptible
 ; No PGO data
 ; 0 inlinees with PGO data; 3 single block inlinees; 0 inlinees without PGO data
 ; Final local variable assignments
 ;
-;  V00 this         [V00,T00] (  8,  6.50)     ref  ->  [rbp-0x28]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
+;  V00 this         [V00,T00] (  8,  6.50)     ref  ->  [rbp-0x20]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
 ;  V01 arg1         [V01,T01] (  3,  3   )    long  ->  rbx         single-def
-;  V02 arg2         [V02    ] (  3,  3   )  double  ->  [rbp-0x18]  do-not-enreg[X] addr-exposed ld-addr-op single-def
-;  V03 loc0         [V03,T02] (  3,  3   )     int  ->  r15        
-;  V04 loc1         [V04,T03] (  3,  3   )    long  ->  rbx        
-;  V05 loc2         [V05    ] (  4,  3   )   ubyte  ->  [rbp-0x20]  do-not-enreg[X] addr-exposed ld-addr-op
+;  V02 arg2         [V02,T05] (  3,  3   )  double  ->  [rbp-0x10]  single-def
+;  V03 loc0         [V03,T03] (  2,  2   )     int  ->  rax        
+;  V04 loc1         [V04,T02] (  3,  3   )    long  ->  rbx        
+;  V05 loc2         [V05    ] (  4,  3   )   ubyte  ->  [rbp-0x18]  do-not-enreg[X] addr-exposed ld-addr-op
 ;# V06 OutArgs      [V06    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
 ;* V07 tmp1         [V07    ] (  0,  0   )    long  ->  zero-ref    "impAppendStmt"
 ;  V08 PSPSym       [V08,T04] (  1,  1   )    long  ->  [rbp-0x30]  do-not-enreg[V] "PSPSym"
 ;
-; Lcl frame size = 32
+; Lcl frame size = 40
 
 G_M55238_IG01:
        push     rbp
-       push     r15
        push     rbx
-       sub      rsp, 32
+       sub      rsp, 40
        lea      rbp, [rsp+0x30]
        mov      qword ptr [rbp-0x30], rsp
-       mov      gword ptr [rbp-0x28], rdi
-       vmovsd   qword ptr [rbp-0x18], xmm0
+       mov      gword ptr [rbp-0x20], rdi
+       vmovsd   qword ptr [rbp-0x10], xmm0
        mov      rbx, rsi
-						;; size=29 bbWeight=1 PerfScore 7.00
+						;; size=27 bbWeight=1 PerfScore 6.00
 G_M55238_IG02:
        cmp      qword ptr [rdi+0x18], -1
        je       SHORT G_M55238_IG08
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SizeOf[double]():uint
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SizeOf[double]():uint
-       mov      r15d, eax
-       mov      rdi, gword ptr [rbp-0x28]
+       mov      rdi, gword ptr [rbp-0x20]
        add      rbx, qword ptr [rdi+0x08]
-       mov      edx, r15d
+       mov      edx, eax
        mov      rsi, rbx
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        xor      esi, esi
-       mov      dword ptr [rbp-0x20], esi
-						;; size=53 bbWeight=1 PerfScore 16.50
+       mov      dword ptr [rbp-0x18], esi
+						;; size=49 bbWeight=1 PerfScore 16.25
 G_M55238_IG03:
-       lea      rsi, [rbp-0x20]
-       mov      rdi, gword ptr [rbp-0x28]
+       lea      rsi, [rbp-0x18]
+       mov      rdi, gword ptr [rbp-0x20]
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
-       mov      edx, r15d
-       lea      rsi, [rbp-0x18]
-       mov      rdi, rbx
-       mov      rax, 0xD1FFAB1E      ; code for System.SpanHelpers:Memmove(byref,byref,ulong)
-       call     [rax]System.SpanHelpers:Memmove(byref,byref,ulong)
-       nop      
-						;; size=43 bbWeight=1 PerfScore 9.25
+       vmovsd   xmm0, qword ptr [rbp-0x10]
+       vmovsd   qword ptr [rbx], xmm0
+						;; size=29 bbWeight=1 PerfScore 9.75
 G_M55238_IG04:
-       cmp      byte  ptr [rbp-0x20], 0
+       cmp      byte  ptr [rbp-0x18], 0
        je       SHORT G_M55238_IG06
 						;; size=6 bbWeight=1 PerfScore 3.00
 G_M55238_IG05:
-       mov      rdi, gword ptr [rbp-0x28]
+       mov      rdi, gword ptr [rbp-0x20]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=18 bbWeight=0.50 PerfScore 2.25
 G_M55238_IG06:
        nop      
 						;; size=1 bbWeight=1 PerfScore 0.25
 G_M55238_IG07:
-       add      rsp, 32
+       add      rsp, 40
        pop      rbx
-       pop      r15
        pop      rbp
        ret      
-						;; size=9 bbWeight=1 PerfScore 2.75
+						;; size=7 bbWeight=1 PerfScore 2.25
 G_M55238_IG08:
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        call     [rax]System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        mov      rdi, rax
        call     CORINFO_HELP_THROW
        int3     
 						;; size=21 bbWeight=0 PerfScore 0.00
 G_M55238_IG09:
        push     rbp
-       push     r15
        push     rbx
-       sub      rsp, 16
+       push     rax
        mov      rbp, qword ptr [rdi]
        mov      qword ptr [rsp], rbp
        lea      rbp, [rbp+0x30]
-						;; size=19 bbWeight=0 PerfScore 0.00
+						;; size=14 bbWeight=0 PerfScore 0.00
 G_M55238_IG10:
-       cmp      byte  ptr [rbp-0x20], 0
+       cmp      byte  ptr [rbp-0x18], 0
        je       SHORT G_M55238_IG11
-       mov      rdi, gword ptr [rbp-0x28]
+       mov      rdi, gword ptr [rbp-0x20]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=24 bbWeight=0 PerfScore 0.00
 G_M55238_IG11:
        nop      
 						;; size=1 bbWeight=0 PerfScore 0.00
 G_M55238_IG12:
-       add      rsp, 16
+       add      rsp, 8
        pop      rbx
-       pop      r15
        pop      rbp
        ret      
-						;; size=9 bbWeight=0 PerfScore 0.00
+						;; size=7 bbWeight=0 PerfScore 0.00
 
-; Total bytes of code 233, prolog size 29, PerfScore 41.00, instruction count 68, allocated bytes for code 233 (MethodHash=67b02839) for method System.Runtime.InteropServices.SafeBuffer:Write[double](ulong,double):this (FullOpts)
+; Total bytes of code 204, prolog size 27, PerfScore 39.75, instruction count 59, allocated bytes for code 204 (MethodHash=67b02839) for method System.Runtime.InteropServices.SafeBuffer:Write[double](ulong,double):this (FullOpts)
-25 (-10.78 % of base) - System.Runtime.InteropServices.SafeBuffer:Write[long](ulong,long):this
 ; Assembly listing for method System.Runtime.InteropServices.SafeBuffer:Write[long](ulong,long):this (FullOpts)
 ; Emitting BLENDED_CODE for X64 with AVX512 - Unix
 ; FullOpts code
 ; optimized code
 ; rbp based frame
 ; fully interruptible
 ; No PGO data
 ; 0 inlinees with PGO data; 3 single block inlinees; 0 inlinees without PGO data
 ; Final local variable assignments
 ;
-;  V00 this         [V00,T00] (  8,  6.50)     ref  ->  [rbp-0x28]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
+;  V00 this         [V00,T00] (  8,  6.50)     ref  ->  [rbp-0x20]  this class-hnd EH-live single-def <System.Runtime.InteropServices.SafeBuffer>
 ;  V01 arg1         [V01,T01] (  3,  3   )    long  ->  rbx         single-def
-;  V02 arg2         [V02    ] (  3,  3   )    long  ->  [rbp-0x18]  do-not-enreg[X] addr-exposed ld-addr-op single-def
-;  V03 loc0         [V03,T02] (  3,  3   )     int  ->  r15        
+;  V02 arg2         [V02,T02] (  3,  3   )    long  ->  r15         single-def
+;  V03 loc0         [V03,T04] (  2,  2   )     int  ->  rax        
 ;  V04 loc1         [V04,T03] (  3,  3   )    long  ->  rbx        
-;  V05 loc2         [V05    ] (  4,  3   )   ubyte  ->  [rbp-0x20]  do-not-enreg[X] addr-exposed ld-addr-op
+;  V05 loc2         [V05    ] (  4,  3   )   ubyte  ->  [rbp-0x18]  do-not-enreg[X] addr-exposed ld-addr-op
 ;# V06 OutArgs      [V06    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
 ;* V07 tmp1         [V07    ] (  0,  0   )    long  ->  zero-ref    "impAppendStmt"
-;  V08 PSPSym       [V08,T04] (  1,  1   )    long  ->  [rbp-0x30]  do-not-enreg[V] "PSPSym"
+;  V08 PSPSym       [V08,T05] (  1,  1   )    long  ->  [rbp-0x30]  do-not-enreg[V] "PSPSym"
 ;
 ; Lcl frame size = 32
 
 G_M39494_IG01:
        push     rbp
        push     r15
        push     rbx
        sub      rsp, 32
        lea      rbp, [rsp+0x30]
        mov      qword ptr [rbp-0x30], rsp
-       mov      gword ptr [rbp-0x28], rdi
-       mov      qword ptr [rbp-0x18], rdx
+       mov      gword ptr [rbp-0x20], rdi
        mov      rbx, rsi
-						;; size=28 bbWeight=1 PerfScore 7.00
+       mov      r15, rdx
+						;; size=27 bbWeight=1 PerfScore 6.25
 G_M39494_IG02:
        cmp      qword ptr [rdi+0x18], -1
        je       SHORT G_M39494_IG08
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SizeOf[long]():uint
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SizeOf[long]():uint
-       mov      r15d, eax
-       mov      rdi, gword ptr [rbp-0x28]
+       mov      rdi, gword ptr [rbp-0x20]
        add      rbx, qword ptr [rdi+0x08]
-       mov      edx, r15d
+       mov      edx, eax
        mov      rsi, rbx
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        call     [rax]System.Runtime.InteropServices.SafeBuffer:SpaceCheck(ulong,ulong):this
        xor      esi, esi
-       mov      dword ptr [rbp-0x20], esi
-						;; size=53 bbWeight=1 PerfScore 16.50
+       mov      dword ptr [rbp-0x18], esi
+						;; size=49 bbWeight=1 PerfScore 16.25
 G_M39494_IG03:
-       lea      rsi, [rbp-0x20]
-       mov      rdi, gword ptr [rbp-0x28]
+       lea      rsi, [rbp-0x18]
+       mov      rdi, gword ptr [rbp-0x20]
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
-       mov      edx, r15d
-       lea      rsi, [rbp-0x18]
-       mov      rdi, rbx
-       mov      rax, 0xD1FFAB1E      ; code for System.SpanHelpers:Memmove(byref,byref,ulong)
-       call     [rax]System.SpanHelpers:Memmove(byref,byref,ulong)
-       nop      
-						;; size=43 bbWeight=1 PerfScore 9.25
+       mov      qword ptr [rbx], r15
+						;; size=23 bbWeight=1 PerfScore 5.75
 G_M39494_IG04:
-       cmp      byte  ptr [rbp-0x20], 0
+       cmp      byte  ptr [rbp-0x18], 0
        je       SHORT G_M39494_IG06
 						;; size=6 bbWeight=1 PerfScore 3.00
 G_M39494_IG05:
-       mov      rdi, gword ptr [rbp-0x28]
+       mov      rdi, gword ptr [rbp-0x20]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=18 bbWeight=0.50 PerfScore 2.25
 G_M39494_IG06:
        nop      
 						;; size=1 bbWeight=1 PerfScore 0.25
 G_M39494_IG07:
        add      rsp, 32
        pop      rbx
        pop      r15
        pop      rbp
        ret      
 						;; size=9 bbWeight=1 PerfScore 2.75
 G_M39494_IG08:
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        call     [rax]System.Runtime.InteropServices.SafeBuffer:NotInitialized():System.InvalidOperationException
        mov      rdi, rax
        call     CORINFO_HELP_THROW
        int3     
 						;; size=21 bbWeight=0 PerfScore 0.00
 G_M39494_IG09:
        push     rbp
        push     r15
        push     rbx
        sub      rsp, 16
        mov      rbp, qword ptr [rdi]
        mov      qword ptr [rsp], rbp
        lea      rbp, [rbp+0x30]
 						;; size=19 bbWeight=0 PerfScore 0.00
 G_M39494_IG10:
-       cmp      byte  ptr [rbp-0x20], 0
+       cmp      byte  ptr [rbp-0x18], 0
        je       SHORT G_M39494_IG11
-       mov      rdi, gword ptr [rbp-0x28]
+       mov      rdi, gword ptr [rbp-0x20]
        xor      esi, esi
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:InternalRelease(ubyte):this
 						;; size=24 bbWeight=0 PerfScore 0.00
 G_M39494_IG11:
        nop      
 						;; size=1 bbWeight=0 PerfScore 0.00
 G_M39494_IG12:
        add      rsp, 16
        pop      rbx
        pop      r15
        pop      rbp
        ret      
 						;; size=9 bbWeight=0 PerfScore 0.00
 
-; Total bytes of code 232, prolog size 28, PerfScore 41.00, instruction count 68, allocated bytes for code 232 (MethodHash=59f965b9) for method System.Runtime.InteropServices.SafeBuffer:Write[long](ulong,long):this (FullOpts)
+; Total bytes of code 207, prolog size 27, PerfScore 36.50, instruction count 62, allocated bytes for code 207 (MethodHash=59f965b9) for method System.Runtime.InteropServices.SafeBuffer:Write[long](ulong,long):this (FullOpts)

Larger list of diffs: https://gist.github.com/MihuBot/b3639a64f40ce798f1a8105e2ee156e3

@MihuBot
Copy link
Owner Author

MihuBot commented Jul 22, 2024

@xtqqczze

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant