Skip to content

[X64] [jakobbotsch] JIT: Fold more always failing type checks #223

Open

Description

@MihuBot

Build completed in 1 hour 34 minutes.
dotnet/runtime#97005

CoreLib diffs

Found 2 files with textual diffs.

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 7284601
Total bytes of diff: 7284558
Total bytes of delta: -43 (-0.00 % of base)
Total relative delta: -0.13
    diff is an improvement.
    relative diff is an improvement.


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

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

Top method improvements (bytes):
         -43 (-13.48 % of base) : System.Private.CoreLib.dasm - System.Reflection.RuntimeCustomAttributeData:Init(System.Runtime.CompilerServices.TypeForwardedToAttribute):this (FullOpts)

Top method improvements (percentages):
         -43 (-13.48 % of base) : System.Private.CoreLib.dasm - System.Reflection.RuntimeCustomAttributeData:Init(System.Runtime.CompilerServices.TypeForwardedToAttribute):this (FullOpts)

1 total methods with Code Size differences (1 improved, 0 regressed), 55874 unchanged.

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

Frameworks diffs

Diffs
Found 261 files with textual diffs.

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 38613028
Total bytes of diff: 38612852
Total bytes of delta: -176 (-0.00 % of base)
Total relative delta: 0.83
    diff is an improvement.
    relative diff is a regression.


Top file regressions (bytes):
         312 : System.Data.Common.dasm (0.02 % of base)

Top file improvements (bytes):
        -231 : System.Text.Json.dasm (-0.02 % of base)
        -155 : System.ComponentModel.Composition.dasm (-0.04 % of base)
         -59 : System.Reflection.MetadataLoadContext.dasm (-0.02 % of base)
         -43 : System.Private.CoreLib.dasm (-0.00 % of base)

5 total files with Code Size differences (4 improved, 1 regressed), 251 unchanged.

Top method regressions (bytes):
          52 (39.10 % of base) : System.Data.Common.dasm - System.Data.EnumerableRowCollectionExtensions:Select[double,System.Nullable`1[int]](System.Data.EnumerableRowCollection`1[double],System.Func`2[double,System.Nullable`1[int]]):System.Data.EnumerableRowCollection`1[System.Nullable`1[int]] (FullOpts)
          52 (39.10 % of base) : System.Data.Common.dasm - System.Data.EnumerableRowCollectionExtensions:Select[int,System.Nullable`1[int]](System.Data.EnumerableRowCollection`1[int],System.Func`2[int,System.Nullable`1[int]]):System.Data.EnumerableRowCollection`1[System.Nullable`1[int]] (FullOpts)
          52 (39.10 % of base) : System.Data.Common.dasm - System.Data.EnumerableRowCollectionExtensions:Select[long,System.Nullable`1[int]](System.Data.EnumerableRowCollection`1[long],System.Func`2[long,System.Nullable`1[int]]):System.Data.EnumerableRowCollection`1[System.Nullable`1[int]] (FullOpts)
          52 (39.10 % of base) : System.Data.Common.dasm - System.Data.EnumerableRowCollectionExtensions:Select[short,System.Nullable`1[int]](System.Data.EnumerableRowCollection`1[short],System.Func`2[short,System.Nullable`1[int]]):System.Data.EnumerableRowCollection`1[System.Nullable`1[int]] (FullOpts)
          52 (39.10 % of base) : System.Data.Common.dasm - System.Data.EnumerableRowCollectionExtensions:Select[System.Numerics.Vector`1[float],System.Nullable`1[int]](System.Data.EnumerableRowCollection`1[System.Numerics.Vector`1[float]],System.Func`2[System.Numerics.Vector`1[float],System.Nullable`1[int]]):System.Data.EnumerableRowCollection`1[System.Nullable`1[int]] (FullOpts)
          52 (39.10 % of base) : System.Data.Common.dasm - System.Data.EnumerableRowCollectionExtensions:Select[ubyte,System.Nullable`1[int]](System.Data.EnumerableRowCollection`1[ubyte],System.Func`2[ubyte,System.Nullable`1[int]]):System.Data.EnumerableRowCollection`1[System.Nullable`1[int]] (FullOpts)

Top method improvements (bytes):
        -116 (-32.77 % of base) : System.ComponentModel.Composition.dasm - System.ComponentModel.Composition.CompositionException+<>c__DisplayClass19_0:<CalculatePaths>b__0(System.Collections.Generic.Stack`1[System.ComponentModel.Composition.CompositionError]):this (FullOpts)
         -53 (-10.52 % of base) : System.Reflection.MetadataLoadContext.dasm - System.Reflection.TypeLoading.CustomAttributeHelpers:CloneForApiReturn(System.Reflection.CustomAttributeTypedArgument):System.Reflection.CustomAttributeTypedArgument (FullOpts)
         -43 (-13.48 % of base) : System.Private.CoreLib.dasm - System.Reflection.RuntimeCustomAttributeData:Init(System.Runtime.CompilerServices.TypeForwardedToAttribute):this (FullOpts)
         -39 (-11.68 % of base) : System.ComponentModel.Composition.dasm - System.ComponentModel.Composition.Hosting.CatalogExportProvider+<>c__DisplayClass43_0:<UpdateRejections>b__0():this (FullOpts)
         -33 (-9.09 % of base) : System.Text.Json.dasm - System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1[double]:SetShouldSerialize(System.Delegate):this (FullOpts)
         -33 (-9.09 % of base) : System.Text.Json.dasm - System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1[int]:SetShouldSerialize(System.Delegate):this (FullOpts)
         -33 (-9.09 % of base) : System.Text.Json.dasm - System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1[long]:SetShouldSerialize(System.Delegate):this (FullOpts)
         -33 (-9.09 % of base) : System.Text.Json.dasm - System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1[short]:SetShouldSerialize(System.Delegate):this (FullOpts)
         -33 (-9.09 % of base) : System.Text.Json.dasm - System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1[System.Nullable`1[int]]:SetShouldSerialize(System.Delegate):this (FullOpts)
         -33 (-9.09 % of base) : System.Text.Json.dasm - System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1[System.Numerics.Vector`1[float]]:SetShouldSerialize(System.Delegate):this (FullOpts)
         -33 (-9.09 % of base) : System.Text.Json.dasm - System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1[ubyte]:SetShouldSerialize(System.Delegate):this (FullOpts)
          -6 (-19.35 % of base) : System.Reflection.MetadataLoadContext.dasm - System.Reflection.TypeLoading.RoConstructedGenericType:GetTypeCodeImpl():int:this (FullOpts)

Top method regressions (percentages):
          52 (39.10 % of base) : System.Data.Common.dasm - System.Data.EnumerableRowCollectionExtensions:Select[double,System.Nullable`1[int]](System.Data.EnumerableRowCollection`1[double],System.Func`2[double,System.Nullable`1[int]]):System.Data.EnumerableRowCollection`1[System.Nullable`1[int]] (FullOpts)
          52 (39.10 % of base) : System.Data.Common.dasm - System.Data.EnumerableRowCollectionExtensions:Select[int,System.Nullable`1[int]](System.Data.EnumerableRowCollection`1[int],System.Func`2[int,System.Nullable`1[int]]):System.Data.EnumerableRowCollection`1[System.Nullable`1[int]] (FullOpts)
          52 (39.10 % of base) : System.Data.Common.dasm - System.Data.EnumerableRowCollectionExtensions:Select[long,System.Nullable`1[int]](System.Data.EnumerableRowCollection`1[long],System.Func`2[long,System.Nullable`1[int]]):System.Data.EnumerableRowCollection`1[System.Nullable`1[int]] (FullOpts)
          52 (39.10 % of base) : System.Data.Common.dasm - System.Data.EnumerableRowCollectionExtensions:Select[short,System.Nullable`1[int]](System.Data.EnumerableRowCollection`1[short],System.Func`2[short,System.Nullable`1[int]]):System.Data.EnumerableRowCollection`1[System.Nullable`1[int]] (FullOpts)
          52 (39.10 % of base) : System.Data.Common.dasm - System.Data.EnumerableRowCollectionExtensions:Select[System.Numerics.Vector`1[float],System.Nullable`1[int]](System.Data.EnumerableRowCollection`1[System.Numerics.Vector`1[float]],System.Func`2[System.Numerics.Vector`1[float],System.Nullable`1[int]]):System.Data.EnumerableRowCollection`1[System.Nullable`1[int]] (FullOpts)
          52 (39.10 % of base) : System.Data.Common.dasm - System.Data.EnumerableRowCollectionExtensions:Select[ubyte,System.Nullable`1[int]](System.Data.EnumerableRowCollection`1[ubyte],System.Func`2[ubyte,System.Nullable`1[int]]):System.Data.EnumerableRowCollection`1[System.Nullable`1[int]] (FullOpts)

Top method improvements (percentages):
        -116 (-32.77 % of base) : System.ComponentModel.Composition.dasm - System.ComponentModel.Composition.CompositionException+<>c__DisplayClass19_0:<CalculatePaths>b__0(System.Collections.Generic.Stack`1[System.ComponentModel.Composition.CompositionError]):this (FullOpts)
          -6 (-19.35 % of base) : System.Reflection.MetadataLoadContext.dasm - System.Reflection.TypeLoading.RoConstructedGenericType:GetTypeCodeImpl():int:this (FullOpts)
         -43 (-13.48 % of base) : System.Private.CoreLib.dasm - System.Reflection.RuntimeCustomAttributeData:Init(System.Runtime.CompilerServices.TypeForwardedToAttribute):this (FullOpts)
         -39 (-11.68 % of base) : System.ComponentModel.Composition.dasm - System.ComponentModel.Composition.Hosting.CatalogExportProvider+<>c__DisplayClass43_0:<UpdateRejections>b__0():this (FullOpts)
         -53 (-10.52 % of base) : System.Reflection.MetadataLoadContext.dasm - System.Reflection.TypeLoading.CustomAttributeHelpers:CloneForApiReturn(System.Reflection.CustomAttributeTypedArgument):System.Reflection.CustomAttributeTypedArgument (FullOpts)
         -33 (-9.09 % of base) : System.Text.Json.dasm - System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1[double]:SetShouldSerialize(System.Delegate):this (FullOpts)
         -33 (-9.09 % of base) : System.Text.Json.dasm - System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1[int]:SetShouldSerialize(System.Delegate):this (FullOpts)
         -33 (-9.09 % of base) : System.Text.Json.dasm - System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1[long]:SetShouldSerialize(System.Delegate):this (FullOpts)
         -33 (-9.09 % of base) : System.Text.Json.dasm - System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1[short]:SetShouldSerialize(System.Delegate):this (FullOpts)
         -33 (-9.09 % of base) : System.Text.Json.dasm - System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1[System.Nullable`1[int]]:SetShouldSerialize(System.Delegate):this (FullOpts)
         -33 (-9.09 % of base) : System.Text.Json.dasm - System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1[System.Numerics.Vector`1[float]]:SetShouldSerialize(System.Delegate):this (FullOpts)
         -33 (-9.09 % of base) : System.Text.Json.dasm - System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1[ubyte]:SetShouldSerialize(System.Delegate):this (FullOpts)

18 total methods with Code Size differences (12 improved, 6 regressed), 236913 unchanged.

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

Artifacts:

Activity

  1. MihuBot commented on Jan 15, 2024

    @MihuBot
    OwnerAuthor

    Top method improvements

    -43 (-13.48 % of base) - System.Reflection.RuntimeCustomAttributeData:Init(System.Runtime.CompilerServices.TypeForwardedToAttribute):this
     ; Assembly listing for method System.Reflection.RuntimeCustomAttributeData:Init(System.Runtime.CompilerServices.TypeForwardedToAttribute):this (FullOpts)
     ; Emitting BLENDED_CODE for X64 with AVX512 - Unix
     ; FullOpts code
     ; optimized code
     ; rbp based frame
     ; partially interruptible
     ; No PGO data
     ; 0 inlinees with PGO data; 4 single block inlinees; 1 inlinees without PGO data
     ; Final local variable assignments
     ;
     ;  V00 this         [V00,T00] (  5,  5   )     ref  ->  rbx         this class-hnd single-def <System.Reflection.RuntimeCustomAttributeData>
     ;  V01 arg1         [V01,T03] (  3,  3   )     ref  ->  r15         class-hnd single-def <System.Runtime.CompilerServices.TypeForwardedToAttribute>
     ;* V02 loc0         [V02    ] (  0,  0   )     ref  ->  zero-ref    class-hnd exact single-def <System.RuntimeType>
     ;* V03 loc1         [V03    ] (  0,  0   )     ref  ->  zero-ref    class-hnd exact single-def <System.Type[]>
     ;  V04 loc2         [V04,T06] (  3,  3   )     ref  ->  r14         class-hnd exact single-def <System.Reflection.CustomAttributeTypedArgument[]>
     ;# V05 OutArgs      [V05    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
     ;  V06 tmp1         [V06,T01] (  3,  6   )     ref  ->  r14         class-hnd exact single-def "dup spill" <System.Type[]>
     ;* V07 tmp2         [V07    ] (  0,  0   )     ref  ->  zero-ref    class-hnd exact single-def "Strict ordering of exceptions for Array store" <System.RuntimeType>
    -;* V08 tmp3         [V08    ] (  0,  0   )     ref  ->  zero-ref    class-hnd exact single-def "impAppendStmt" <System.RuntimeType>
    +;* V08 tmp3         [V08,T09] (  0,  0   )     ref  ->  zero-ref    class-hnd exact single-def "impAppendStmt" <System.RuntimeType>
     ;* V09 tmp4         [V09    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.Reflection.CustomAttributeTypedArgument>
    -;  V10 tmp5         [V10,T04] (  3,  5   )     ref  ->  r15         class-hnd single-def "Inlining Arg" <System.Type>
    -;  V11 tmp6         [V11,T08] (  3,  2   )     ref  ->  r15         class-hnd "Inline return value spill temp" <System.Object>
    -;  V12 tmp7         [V12,T07] (  3,  2.50)     ref  ->  rax         class-hnd single-def "Inline stloc first use temp" <System.Enum>
    -;  V13 tmp8         [V13,T09] (  2,  2   )     ref  ->  rsi         single-def "field V09._value (fldOffset=0x0)" P-INDEP
    +;  V10 tmp5         [V10,T05] (  2,  4   )     ref  ->  r15         class-hnd single-def "Inlining Arg" <System.Type>
    +;  V11 tmp6         [V11,T07] (  2,  2   )     ref  ->  rsi         class-hnd single-def "Inline return value spill temp" <System.Object>
    +;* V12 tmp7         [V12    ] (  0,  0   )     ref  ->  zero-ref    class-hnd single-def "Inline stloc first use temp" <System.Enum>
    +;  V13 tmp8         [V13,T08] (  2,  2   )     ref  ->  rsi         single-def "field V09._value (fldOffset=0x0)" P-INDEP
     ;* V14 tmp9         [V14,T10] (  0,  0   )     ref  ->  zero-ref    single-def "field V09._argumentType (fldOffset=0x8)" P-INDEP
     ;  V15 tmp10        [V15,T02] (  3,  6   )   byref  ->  r15         single-def "BlockOp address local"
    -;  V16 cse0         [V16,T05] (  3,  3   )     ref  ->  r13         "CSE - aggressive"
    +;  V16 cse0         [V16,T04] (  3,  3   )     ref  ->  r13         "CSE - aggressive"
     ;
     ; Lcl frame size = 0
     
     G_M26233_IG01:
            push     rbp
            push     r15
            push     r14
            push     r13
            push     rbx
            lea      rbp, [rsp+0x20]
            mov      rbx, rdi
            mov      r15, rsi
     						;; size=19 bbWeight=1 PerfScore 6.00
     G_M26233_IG02:
            mov      rdi, 0xD1FFAB1E      ; System.Type[]
            mov      esi, 1
            call     CORINFO_HELP_NEWARR_1_OBJ
            mov      r14, rax
            lea      rdi, bword ptr [r14+0x10]
            mov      r13, 0xD1FFAB1E      ; 'System.Type'
     
            mov      rsi, r13
            call     CORINFO_HELP_ASSIGN_REF
            mov      r8, r14
            mov      rdi, 0xD1FFAB1E      ; 'System.Runtime.CompilerServices.TypeForwardedToAttribute'
     
            mov      esi, 20
            xor      rdx, rdx
            mov      ecx, 3
            xor      r9, r9
            mov      rax, 0xD1FFAB1E      ; code for System.Type:GetConstructor(int,System.Reflection.Binder,int,System.Type[],System.Reflection.ParameterModifier[]):System.Reflection.ConstructorInfo:this
            call     [rax]System.Type:GetConstructor(int,System.Reflection.Binder,int,System.Type[],System.Reflection.ParameterModifier[]):System.Reflection.ConstructorInfo:this
            lea      rdi, bword ptr [rbx+0x08]
            mov      rsi, rax
            call     CORINFO_HELP_ASSIGN_REF
            mov      rdi, 0xD1FFAB1E      ; System.Reflection.CustomAttributeTypedArgument[]
            mov      esi, 1
            call     CORINFO_HELP_NEWARR_1_VC
            mov      r14, rax
            mov      r15, gword ptr [r15+0x08]
            mov      rdi, r13
            mov      rsi, 0xD1FFAB1E      ; 'argumentType'
     
            mov      rax, 0xD1FFAB1E      ; code for System.ArgumentNullException:ThrowIfNull(System.Object,System.String)
            call     [rax]System.ArgumentNullException:ThrowIfNull(System.Object,System.String)
    -       mov      rsi, r15
    -       mov      rdi, 0xD1FFAB1E      ; System.Enum
    -       call     CORINFO_HELP_ISINSTANCEOFCLASS
    -       test     rax, rax
    -       jne      SHORT G_M26233_IG04
    -						;; size=172 bbWeight=1 PerfScore 20.50
    -G_M26233_IG03:
    -       jmp      SHORT G_M26233_IG05
    -						;; size=2 bbWeight=0.50 PerfScore 1.00
    -G_M26233_IG04:
    -       mov      rdi, rax
    -       mov      rax, 0xD1FFAB1E      ; code for System.Enum:GetValue():System.Object:this
    -       call     [rax]System.Enum:GetValue():System.Object:this
    -       mov      r15, rax
    -						;; size=18 bbWeight=0.50 PerfScore 1.88
    -G_M26233_IG05:
            mov      rsi, r15
            lea      r15, bword ptr [r14+0x10]
            mov      rdi, r15
            call     CORINFO_HELP_CHECKED_ASSIGN_REF
            mov      rdi, 0xD1FFAB1E      ; 'System.Type'
     
            mov      gword ptr [r15+0x08], rdi
            mov      rdi, r14
            mov      rax, 0xD1FFAB1E      ; code for System.Array:AsReadOnly[System.Reflection.CustomAttributeTypedArgument](System.Reflection.CustomAttributeTypedArgument[]):System.Collections.ObjectModel.ReadOnlyCollection`1[System.Reflection.CustomAttributeTypedArgument]
            call     [rax]System.Array:AsReadOnly[System.Reflection.CustomAttributeTypedArgument](System.Reflection.CustomAttributeTypedArgument[]):System.Collections.ObjectModel.ReadOnlyCollection`1[System.Reflection.CustomAttributeTypedArgument]
            lea      rdi, bword ptr [rbx+0x30]
            mov      rsi, rax
            call     CORINFO_HELP_ASSIGN_REF
            mov      rdi, 0xD1FFAB1E
            mov      esi, 649
            call     CORINFO_HELP_CLASSINIT_SHARED_DYNAMICCLASS
            mov      rdi, 0xD1FFAB1E      ; data for System.Array+EmptyArray`1[System.Reflection.CustomAttributeNamedArgument]:Value
            mov      rsi, gword ptr [rdi]
            lea      rdi, bword ptr [rbx+0x38]
            call     CORINFO_HELP_ASSIGN_REF
            nop      
    -						;; size=99 bbWeight=1 PerfScore 14.00
    -G_M26233_IG06:
    +						;; size=248 bbWeight=1 PerfScore 31.75
    +G_M26233_IG03:
            pop      rbx
            pop      r13
            pop      r14
            pop      r15
            pop      rbp
            ret      
     						;; size=9 bbWeight=1 PerfScore 3.50
     
    -; Total bytes of code 319, prolog size 13, PerfScore 78.78, instruction count 72, allocated bytes for code 319 (MethodHash=82939986) for method System.Reflection.RuntimeCustomAttributeData:Init(System.Runtime.CompilerServices.TypeForwardedToAttribute):this (FullOpts)
    +; Total bytes of code 276, prolog size 13, PerfScore 68.85, instruction count 62, allocated bytes for code 276 (MethodHash=82939986) for method System.Reflection.RuntimeCustomAttributeData:Init(System.Runtime.CompilerServices.TypeForwardedToAttribute):this (FullOpts)
  2. MihuBot commented on Jan 15, 2024

    @MihuBot
    OwnerAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions