Skip to content

Inliner misses some constant arguments due to casts #47123

@SingleAccretion

Description

@SingleAccretion

Example of the problem (reproduces on master): sharplab.

In short, the observation that the argument is invariant is not made for nodes of this shape:

Argument #0:
               [000001] ------------              *  CAST      long <- int
               [000000] ------------              \--*  CNS_INT   int    10

Which can lead to two things:

  1. Missed inlining opportunities.
  2. Missed opportunities of early pruning for methods that are inlined for other reasons (my guess is this only happens in the real world for things marked with aggressive inlining).

Notably, the emission of small int64 constants in IL should be done with casts from int32s as that uses less bytes.

I decided to see how much impact this has by checking for this pattern in Compiler::impInlineInitVars - 55b2986db60ea544a60670fe5bc4ad09660fc6a9. The resulting diffs are few in number and are mostly regressions due to more inlining, with one fairly pathological case of improvement in AsnWriter.WriteGeneralizedTimeCore.

Diffs with crossgen (mostly regressions)
Crossgen CodeSize Diffs for System.Private.CoreLib.dll, framework assemblies for  default jit

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 33727626
Total bytes of diff: 33727982
Total bytes of delta: 356 (0.00% of base)
    diff is a regression.

Top file regressions (bytes):
         205 : System.DirectoryServices.dasm (0.06% of base)
         111 : FSharp.Core.dasm (0.01% of base)
          86 : System.ServiceModel.Syndication.dasm (0.10% of base)
           8 : System.Security.Cryptography.Algorithms.dasm (0.00% of base)
           8 : System.Security.Cryptography.Cng.dasm (0.00% of base)
           2 : System.Data.Odbc.dasm (0.00% of base)
           1 : System.Memory.dasm (0.00% of base)

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

8 total files with Code Size differences (1 improved, 7 regressed), 262 unchanged.

Top method regressions (bytes):
          65 ( 7.80% of base) : FSharp.Core.dasm - HashCompare:GenericEqualityArbArray(bool,System.Collections.IEqualityComparer,System.Array,System.Array):bool
          53 (15.59% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.ActiveDirectorySite:GetComputerSite():System.DirectoryServices.ActiveDirectory.ActiveDirectorySite
          51 (10.83% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.Domain:CreateLocalSideOfTrustRelationship(System.String,int,System.String):this
          51 (10.71% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.Forest:CreateLocalSideOfTrustRelationship(System.String,int,System.String):this
          50 (33.11% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.DirectoryContext:isCurrentForest():bool:this
          46 ( 4.92% of base) : FSharp.Core.dasm - HashCompare:GenericComparisonArbArrayWithComparer(GenericComparer,System.Array,System.Array):int
          26 (36.62% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateAlternateLink(System.Uri,System.String):System.ServiceModel.Syndication.SyndicationLink
          26 (36.62% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateSelfLink(System.Uri,System.String):System.ServiceModel.Syndication.SyndicationLink
          17 ( 8.54% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationItem:AddPermalink(System.Uri):this
          17 (25.76% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateAlternateLink(System.Uri):System.ServiceModel.Syndication.SyndicationLink
          17 (25.76% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateSelfLink(System.Uri):System.ServiceModel.Syndication.SyndicationLink
          10 ( 1.66% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationFeed:TryReadTextInputFromExtension(System.ServiceModel.Syndication.SyndicationElementExtensionCollection):System.ServiceModel.Syndication.SyndicationTextInput:this
           8 (25.00% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:.ctor(System.Uri):this
           4 ( 0.58% of base) : System.Security.Cryptography.Algorithms.dasm - DSACng:VerifySignatureCore(System.ReadOnlySpan`1[Byte],System.ReadOnlySpan`1[Byte],int):bool:this
           4 ( 0.96% of base) : System.Security.Cryptography.Algorithms.dasm - ECDsaCng:VerifyHashCore(System.ReadOnlySpan`1[Byte],System.ReadOnlySpan`1[Byte],int):bool:this
           4 ( 0.63% of base) : System.Security.Cryptography.Cng.dasm - System.Security.Cryptography.DSACng:VerifySignature(System.ReadOnlySpan`1[Byte],System.ReadOnlySpan`1[Byte]):bool:this
           4 ( 1.02% of base) : System.Security.Cryptography.Cng.dasm - System.Security.Cryptography.ECDsaCng:VerifyHash(System.ReadOnlySpan`1[Byte],System.ReadOnlySpan`1[Byte]):bool:this
           2 ( 0.08% of base) : System.Data.Odbc.dasm - System.Data.Odbc.OdbcDataReader:GetSchemaTable():System.Data.DataTable:this
           1 ( 0.09% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Byte][System.Byte]:TryReadTo(byref,System.ReadOnlySpan`1[Byte],bool):bool:this (2 methods)

Top method improvements (bytes):
         -23 (-16.31% of base) : System.Private.CoreLib.dasm - System.Convert:ToDateTime(System.String):System.DateTime
         -23 (-15.33% of base) : System.Private.CoreLib.dasm - System.Convert:ToDateTime(System.String,System.IFormatProvider):System.DateTime
         -19 (-6.57% of base) : System.Private.CoreLib.dasm - System.DateTimeOffset:.cctor()
         -11 (-21.15% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationFeed:CreateLink():System.ServiceModel.Syndication.SyndicationLink:this
         -11 (-21.15% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationItem:CreateLink():System.ServiceModel.Syndication.SyndicationLink:this
          -7 (-20.59% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:.ctor():this
          -3 (-0.47% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.Rss20FeedFormatter:ReadAlternateLink(System.Xml.XmlReader,System.Uri,System.ServiceModel.Syndication.TryParseUriCallback,bool):System.ServiceModel.Syndication.SyndicationLink
          -3 (-0.32% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.Rss20FeedFormatter:ReadMediaEnclosure(System.Xml.XmlReader,System.Uri):System.ServiceModel.Syndication.SyndicationLink:this

Top method regressions (percentages):
          26 (36.62% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateAlternateLink(System.Uri,System.String):System.ServiceModel.Syndication.SyndicationLink
          26 (36.62% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateSelfLink(System.Uri,System.String):System.ServiceModel.Syndication.SyndicationLink
          50 (33.11% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.DirectoryContext:isCurrentForest():bool:this
          17 (25.76% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateAlternateLink(System.Uri):System.ServiceModel.Syndication.SyndicationLink
          17 (25.76% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateSelfLink(System.Uri):System.ServiceModel.Syndication.SyndicationLink
           8 (25.00% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:.ctor(System.Uri):this
          53 (15.59% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.ActiveDirectorySite:GetComputerSite():System.DirectoryServices.ActiveDirectory.ActiveDirectorySite
          51 (10.83% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.Domain:CreateLocalSideOfTrustRelationship(System.String,int,System.String):this
          51 (10.71% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.Forest:CreateLocalSideOfTrustRelationship(System.String,int,System.String):this
          17 ( 8.54% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationItem:AddPermalink(System.Uri):this
          65 ( 7.80% of base) : FSharp.Core.dasm - HashCompare:GenericEqualityArbArray(bool,System.Collections.IEqualityComparer,System.Array,System.Array):bool
          46 ( 4.92% of base) : FSharp.Core.dasm - HashCompare:GenericComparisonArbArrayWithComparer(GenericComparer,System.Array,System.Array):int
          10 ( 1.66% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationFeed:TryReadTextInputFromExtension(System.ServiceModel.Syndication.SyndicationElementExtensionCollection):System.ServiceModel.Syndication.SyndicationTextInput:this
           4 ( 1.02% of base) : System.Security.Cryptography.Cng.dasm - System.Security.Cryptography.ECDsaCng:VerifyHash(System.ReadOnlySpan`1[Byte],System.ReadOnlySpan`1[Byte]):bool:this
           4 ( 0.96% of base) : System.Security.Cryptography.Algorithms.dasm - ECDsaCng:VerifyHashCore(System.ReadOnlySpan`1[Byte],System.ReadOnlySpan`1[Byte],int):bool:this
           4 ( 0.63% of base) : System.Security.Cryptography.Cng.dasm - System.Security.Cryptography.DSACng:VerifySignature(System.ReadOnlySpan`1[Byte],System.ReadOnlySpan`1[Byte]):bool:this
           4 ( 0.58% of base) : System.Security.Cryptography.Algorithms.dasm - DSACng:VerifySignatureCore(System.ReadOnlySpan`1[Byte],System.ReadOnlySpan`1[Byte],int):bool:this
           1 ( 0.09% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Byte][System.Byte]:TryReadTo(byref,System.ReadOnlySpan`1[Byte],bool):bool:this (2 methods)
           2 ( 0.08% of base) : System.Data.Odbc.dasm - System.Data.Odbc.OdbcDataReader:GetSchemaTable():System.Data.DataTable:this

Top method improvements (percentages):
         -11 (-21.15% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationFeed:CreateLink():System.ServiceModel.Syndication.SyndicationLink:this
         -11 (-21.15% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationItem:CreateLink():System.ServiceModel.Syndication.SyndicationLink:this
          -7 (-20.59% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:.ctor():this
         -23 (-16.31% of base) : System.Private.CoreLib.dasm - System.Convert:ToDateTime(System.String):System.DateTime
         -23 (-15.33% of base) : System.Private.CoreLib.dasm - System.Convert:ToDateTime(System.String,System.IFormatProvider):System.DateTime
         -19 (-6.57% of base) : System.Private.CoreLib.dasm - System.DateTimeOffset:.cctor()
          -3 (-0.47% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.Rss20FeedFormatter:ReadAlternateLink(System.Xml.XmlReader,System.Uri,System.ServiceModel.Syndication.TryParseUriCallback,bool):System.ServiceModel.Syndication.SyndicationLink
          -3 (-0.32% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.Rss20FeedFormatter:ReadMediaEnclosure(System.Xml.XmlReader,System.Uri):System.ServiceModel.Syndication.SyndicationLink:this

27 total methods with Code Size differences (8 improved, 19 regressed), 236107 unchanged.
Diffs with PMI (a bit better)
PMI CodeSize Diffs for System.Private.CoreLib.dll, framework assemblies for  default jit

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 52088228
Total bytes of diff: 52088102
Total bytes of delta: -126 (-0.00% of base)
    diff is an improvement.

Top file regressions (bytes):
         195 : System.DirectoryServices.dasm (0.04% of base)
         173 : FSharp.Core.dasm (0.01% of base)
         152 : System.ServiceModel.Syndication.dasm (0.10% of base)
          72 : System.Net.Http.dasm (0.01% of base)
           2 : System.Data.Odbc.dasm (0.00% of base)

Top file improvements (bytes):
        -512 : System.Formats.Asn1.dasm (-0.46% of base)
        -164 : System.Memory.dasm (-0.05% of base)
         -44 : System.Private.CoreLib.dasm (-0.00% of base)

8 total files with Code Size differences (3 improved, 5 regressed), 262 unchanged.

Top method regressions (bytes):
         102 (10.11% of base) : FSharp.Core.dasm - HashCompare:GenericEqualityArbArray(bool,System.Collections.IEqualityComparer,System.Array,System.Array):bool
          72 ( 0.45% of base) : System.Net.Http.dasm - <SendAsyncCore>d__56:MoveNext():this
          71 ( 6.32% of base) : FSharp.Core.dasm - HashCompare:GenericComparisonArbArrayWithComparer(GenericComparer,System.Array,System.Array):int
          50 ( 8.55% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.Domain:CreateLocalSideOfTrustRelationship(System.String,int,System.String):this
          50 ( 8.47% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.Forest:CreateLocalSideOfTrustRelationship(System.String,int,System.String):this
          49 (33.56% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.DirectoryContext:isCurrentForest():bool:this
          46 (12.11% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.ActiveDirectorySite:GetComputerSite():System.DirectoryServices.ActiveDirectory.ActiveDirectorySite
          32 ( 0.74% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.Rss20FeedFormatter:ReadItemFrom(System.Xml.XmlReader,System.ServiceModel.Syndication.SyndicationItem,System.Uri):this
          24 (29.27% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateAlternateLink(System.Uri,System.String):System.ServiceModel.Syndication.SyndicationLink
          24 (29.27% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateSelfLink(System.Uri,System.String):System.ServiceModel.Syndication.SyndicationLink
          20 ( 9.66% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationItem:AddPermalink(System.Uri):this
          16 ( 5.26% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationFeed:.ctor(System.String,System.String,System.Uri,System.String,System.DateTimeOffset,System.Collections.Generic.IEnumerable`1[[System.ServiceModel.Syndication.SyndicationItem, System.ServiceModel.Syndication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]]):this
          16 ( 6.50% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationItem:.ctor(System.String,System.ServiceModel.Syndication.SyndicationContent,System.Uri,System.String,System.DateTimeOffset):this
          16 (20.78% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateAlternateLink(System.Uri):System.ServiceModel.Syndication.SyndicationLink
          16 (20.78% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateSelfLink(System.Uri):System.ServiceModel.Syndication.SyndicationLink
          10 ( 1.33% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationFeed:TryReadTextInputFromExtension(System.ServiceModel.Syndication.SyndicationElementExtensionCollection):System.ServiceModel.Syndication.SyndicationTextInput:this
           8 (25.81% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:.ctor(System.Uri):this
           2 ( 0.09% of base) : System.Data.Odbc.dasm - System.Data.Odbc.OdbcDataReader:GetSchemaTable():System.Data.DataTable:this

Top method improvements (bytes):
        -478 (-3.37% of base) : System.Formats.Asn1.dasm - System.Formats.Asn1.AsnWriter:WriteGeneralizedTimeCore(System.Formats.Asn1.Asn1Tag,System.DateTimeOffset,bool):this
         -49 (-4.16% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Vector`1][System.Numerics.Vector`1[System.Single]]:TryReadTo(byref,System.ReadOnlySpan`1[Vector`1],bool):bool:this (2 methods)
         -34 (-0.35% of base) : System.Formats.Asn1.dasm - System.Formats.Asn1.AsnWriter:WriteUtcTimeCore(System.Formats.Asn1.Asn1Tag,System.DateTimeOffset):this
         -23 (-2.06% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Byte][System.Byte]:TryReadTo(byref,System.ReadOnlySpan`1[Byte],bool):bool:this (2 methods)
         -23 (-2.05% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Int16][System.Int16]:TryReadTo(byref,System.ReadOnlySpan`1[Int16],bool):bool:this (2 methods)
         -23 (-2.05% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Int32][System.Int32]:TryReadTo(byref,System.ReadOnlySpan`1[Int32],bool):bool:this (2 methods)
         -23 (-2.05% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Double][System.Double]:TryReadTo(byref,System.ReadOnlySpan`1[Double],bool):bool:this (2 methods)
         -23 (-2.05% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Int64][System.Int64]:TryReadTo(byref,System.ReadOnlySpan`1[Int64],bool):bool:this (2 methods)
         -22 (-17.19% of base) : System.Private.CoreLib.dasm - System.Convert:ToDateTime(System.String):System.DateTime
         -22 (-16.06% of base) : System.Private.CoreLib.dasm - System.Convert:ToDateTime(System.String,System.IFormatProvider):System.DateTime
         -10 (-16.67% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationFeed:CreateLink():System.ServiceModel.Syndication.SyndicationLink:this
         -10 (-16.67% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationItem:CreateLink():System.ServiceModel.Syndication.SyndicationLink:this
          -6 (-18.18% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:.ctor():this
          -2 (-0.16% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.Rss20FeedFormatter:ReadMediaEnclosure(System.Xml.XmlReader,System.Uri):System.ServiceModel.Syndication.SyndicationLink:this
          -2 (-0.28% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.Rss20FeedFormatter:ReadAlternateLink(System.Xml.XmlReader,System.Uri,System.ServiceModel.Syndication.TryParseUriCallback,bool):System.ServiceModel.Syndication.SyndicationLink

Top method regressions (percentages):
          49 (33.56% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.DirectoryContext:isCurrentForest():bool:this
          24 (29.27% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateAlternateLink(System.Uri,System.String):System.ServiceModel.Syndication.SyndicationLink
          24 (29.27% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateSelfLink(System.Uri,System.String):System.ServiceModel.Syndication.SyndicationLink
           8 (25.81% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:.ctor(System.Uri):this
          16 (20.78% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateAlternateLink(System.Uri):System.ServiceModel.Syndication.SyndicationLink
          16 (20.78% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateSelfLink(System.Uri):System.ServiceModel.Syndication.SyndicationLink
          46 (12.11% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.ActiveDirectorySite:GetComputerSite():System.DirectoryServices.ActiveDirectory.ActiveDirectorySite
         102 (10.11% of base) : FSharp.Core.dasm - HashCompare:GenericEqualityArbArray(bool,System.Collections.IEqualityComparer,System.Array,System.Array):bool
          20 ( 9.66% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationItem:AddPermalink(System.Uri):this
          50 ( 8.55% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.Domain:CreateLocalSideOfTrustRelationship(System.String,int,System.String):this
          50 ( 8.47% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.Forest:CreateLocalSideOfTrustRelationship(System.String,int,System.String):this
          16 ( 6.50% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationItem:.ctor(System.String,System.ServiceModel.Syndication.SyndicationContent,System.Uri,System.String,System.DateTimeOffset):this
          71 ( 6.32% of base) : FSharp.Core.dasm - HashCompare:GenericComparisonArbArrayWithComparer(GenericComparer,System.Array,System.Array):int
          16 ( 5.26% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationFeed:.ctor(System.String,System.String,System.Uri,System.String,System.DateTimeOffset,System.Collections.Generic.IEnumerable`1[[System.ServiceModel.Syndication.SyndicationItem, System.ServiceModel.Syndication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]]):this
          10 ( 1.33% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationFeed:TryReadTextInputFromExtension(System.ServiceModel.Syndication.SyndicationElementExtensionCollection):System.ServiceModel.Syndication.SyndicationTextInput:this
          32 ( 0.74% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.Rss20FeedFormatter:ReadItemFrom(System.Xml.XmlReader,System.ServiceModel.Syndication.SyndicationItem,System.Uri):this
          72 ( 0.45% of base) : System.Net.Http.dasm - <SendAsyncCore>d__56:MoveNext():this
           2 ( 0.09% of base) : System.Data.Odbc.dasm - System.Data.Odbc.OdbcDataReader:GetSchemaTable():System.Data.DataTable:this

Top method improvements (percentages):
          -6 (-18.18% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:.ctor():this
         -22 (-17.19% of base) : System.Private.CoreLib.dasm - System.Convert:ToDateTime(System.String):System.DateTime
         -10 (-16.67% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationFeed:CreateLink():System.ServiceModel.Syndication.SyndicationLink:this
         -10 (-16.67% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationItem:CreateLink():System.ServiceModel.Syndication.SyndicationLink:this
         -22 (-16.06% of base) : System.Private.CoreLib.dasm - System.Convert:ToDateTime(System.String,System.IFormatProvider):System.DateTime
         -49 (-4.16% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Vector`1][System.Numerics.Vector`1[System.Single]]:TryReadTo(byref,System.ReadOnlySpan`1[Vector`1],bool):bool:this (2 methods)
        -478 (-3.37% of base) : System.Formats.Asn1.dasm - System.Formats.Asn1.AsnWriter:WriteGeneralizedTimeCore(System.Formats.Asn1.Asn1Tag,System.DateTimeOffset,bool):this
         -23 (-2.06% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Byte][System.Byte]:TryReadTo(byref,System.ReadOnlySpan`1[Byte],bool):bool:this (2 methods)
         -23 (-2.05% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Double][System.Double]:TryReadTo(byref,System.ReadOnlySpan`1[Double],bool):bool:this (2 methods)
         -23 (-2.05% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Int16][System.Int16]:TryReadTo(byref,System.ReadOnlySpan`1[Int16],bool):bool:this (2 methods)
         -23 (-2.05% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Int32][System.Int32]:TryReadTo(byref,System.ReadOnlySpan`1[Int32],bool):bool:this (2 methods)
         -23 (-2.05% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Int64][System.Int64]:TryReadTo(byref,System.ReadOnlySpan`1[Int64],bool):bool:this (2 methods)
         -34 (-0.35% of base) : System.Formats.Asn1.dasm - System.Formats.Asn1.AsnWriter:WriteUtcTimeCore(System.Formats.Asn1.Asn1Tag,System.DateTimeOffset):this
          -2 (-0.28% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.Rss20FeedFormatter:ReadAlternateLink(System.Xml.XmlReader,System.Uri,System.ServiceModel.Syndication.TryParseUriCallback,bool):System.ServiceModel.Syndication.SyndicationLink
          -2 (-0.16% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.Rss20FeedFormatter:ReadMediaEnclosure(System.Xml.XmlReader,System.Uri):System.ServiceModel.Syndication.SyndicationLink:this

33 total methods with Code Size differences (15 improved, 18 regressed), 345435 unchanged.
Diffs with PMI and "--cctors" (mostly the same, just with one method not being compiled)
PMI CodeSize Diffs for System.Private.CoreLib.dll, framework assemblies [invoking .cctors] for  default jit

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 51377258
Total bytes of diff: 51377079
Total bytes of delta: -179 (-0.00% of base)
    diff is an improvement.

Total byte diff includes -103 bytes from reconciling methods
        Base had    1 unique methods,      103 unique bytes
        Diff had    0 unique methods,        0 unique bytes

Top file regressions (bytes):
         195 : System.DirectoryServices.dasm (0.05% of base)
         173 : FSharp.Core.dasm (0.01% of base)
         152 : System.ServiceModel.Syndication.dasm (0.11% of base)
          72 : System.Net.Http.dasm (0.01% of base)
          50 : System.Net.WebSockets.dasm (0.11% of base)
           2 : System.Data.Odbc.dasm (0.00% of base)

Top file improvements (bytes):
        -512 : System.Formats.Asn1.dasm (-0.47% of base)
        -164 : System.Memory.dasm (-0.05% of base)
        -103 : Microsoft.CodeAnalysis.dasm (-0.01% of base)
         -44 : System.Private.CoreLib.dasm (-0.00% of base)

10 total files with Code Size differences (4 improved, 6 regressed), 260 unchanged.

Top method regressions (bytes):
         102 (10.11% of base) : FSharp.Core.dasm - HashCompare:GenericEqualityArbArray(bool,System.Collections.IEqualityComparer,System.Array,System.Array):bool
          72 ( 0.46% of base) : System.Net.Http.dasm - <SendAsyncCore>d__56:MoveNext():this
          71 ( 6.32% of base) : FSharp.Core.dasm - HashCompare:GenericComparisonArbArrayWithComparer(GenericComparer,System.Array,System.Array):int
          50 ( 8.55% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.Domain:CreateLocalSideOfTrustRelationship(System.String,int,System.String):this
          50 ( 8.47% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.Forest:CreateLocalSideOfTrustRelationship(System.String,int,System.String):this
          50 ( 2.67% of base) : System.Net.WebSockets.dasm - <WaitForServerToCloseConnectionAsync>d__68:MoveNext():this
          49 (33.56% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.DirectoryContext:isCurrentForest():bool:this
          46 (12.11% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.ActiveDirectorySite:GetComputerSite():System.DirectoryServices.ActiveDirectory.ActiveDirectorySite
          32 ( 0.74% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.Rss20FeedFormatter:ReadItemFrom(System.Xml.XmlReader,System.ServiceModel.Syndication.SyndicationItem,System.Uri):this
          24 (29.27% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateAlternateLink(System.Uri,System.String):System.ServiceModel.Syndication.SyndicationLink
          24 (29.27% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateSelfLink(System.Uri,System.String):System.ServiceModel.Syndication.SyndicationLink
          20 ( 9.66% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationItem:AddPermalink(System.Uri):this
          16 ( 5.26% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationFeed:.ctor(System.String,System.String,System.Uri,System.String,System.DateTimeOffset,System.Collections.Generic.IEnumerable`1[[System.ServiceModel.Syndication.SyndicationItem, System.ServiceModel.Syndication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]]):this
          16 ( 6.50% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationItem:.ctor(System.String,System.ServiceModel.Syndication.SyndicationContent,System.Uri,System.String,System.DateTimeOffset):this
          16 (20.78% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateAlternateLink(System.Uri):System.ServiceModel.Syndication.SyndicationLink
          16 (20.78% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateSelfLink(System.Uri):System.ServiceModel.Syndication.SyndicationLink
          10 ( 1.33% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationFeed:TryReadTextInputFromExtension(System.ServiceModel.Syndication.SyndicationElementExtensionCollection):System.ServiceModel.Syndication.SyndicationTextInput:this
           8 (25.81% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:.ctor(System.Uri):this
           2 ( 0.09% of base) : System.Data.Odbc.dasm - System.Data.Odbc.OdbcDataReader:GetSchemaTable():System.Data.DataTable:this

Top method improvements (bytes):
        -478 (-3.37% of base) : System.Formats.Asn1.dasm - System.Formats.Asn1.AsnWriter:WriteGeneralizedTimeCore(System.Formats.Asn1.Asn1Tag,System.DateTimeOffset,bool):this
        -103 (-100.00% of base) : Microsoft.CodeAnalysis.dasm - Microsoft.CodeAnalysis.SmallDictionary`2[__Canon,TargetScope][System.__Canon,Microsoft.CodeAnalysis.Diagnostics.SuppressMessageAttributeState+TargetScope]:LeftComplex(AvlNode[__Canon,TargetScope]):AvlNode[__Canon,TargetScope] (1 base, 0 diff methods)
         -49 (-4.16% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Vector`1][System.Numerics.Vector`1[System.Single]]:TryReadTo(byref,System.ReadOnlySpan`1[Vector`1],bool):bool:this (2 methods)
         -34 (-0.35% of base) : System.Formats.Asn1.dasm - System.Formats.Asn1.AsnWriter:WriteUtcTimeCore(System.Formats.Asn1.Asn1Tag,System.DateTimeOffset):this
         -23 (-2.06% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Byte][System.Byte]:TryReadTo(byref,System.ReadOnlySpan`1[Byte],bool):bool:this (2 methods)
         -23 (-2.05% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Int16][System.Int16]:TryReadTo(byref,System.ReadOnlySpan`1[Int16],bool):bool:this (2 methods)
         -23 (-2.05% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Int32][System.Int32]:TryReadTo(byref,System.ReadOnlySpan`1[Int32],bool):bool:this (2 methods)
         -23 (-2.05% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Double][System.Double]:TryReadTo(byref,System.ReadOnlySpan`1[Double],bool):bool:this (2 methods)
         -23 (-2.05% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Int64][System.Int64]:TryReadTo(byref,System.ReadOnlySpan`1[Int64],bool):bool:this (2 methods)
         -22 (-17.19% of base) : System.Private.CoreLib.dasm - System.Convert:ToDateTime(System.String):System.DateTime
         -22 (-16.06% of base) : System.Private.CoreLib.dasm - System.Convert:ToDateTime(System.String,System.IFormatProvider):System.DateTime
         -10 (-16.67% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationFeed:CreateLink():System.ServiceModel.Syndication.SyndicationLink:this
         -10 (-16.67% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationItem:CreateLink():System.ServiceModel.Syndication.SyndicationLink:this
          -6 (-18.18% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:.ctor():this
          -2 (-0.16% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.Rss20FeedFormatter:ReadMediaEnclosure(System.Xml.XmlReader,System.Uri):System.ServiceModel.Syndication.SyndicationLink:this
          -2 (-0.28% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.Rss20FeedFormatter:ReadAlternateLink(System.Xml.XmlReader,System.Uri,System.ServiceModel.Syndication.TryParseUriCallback,bool):System.ServiceModel.Syndication.SyndicationLink

Top method regressions (percentages):
          49 (33.56% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.DirectoryContext:isCurrentForest():bool:this
          24 (29.27% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateAlternateLink(System.Uri,System.String):System.ServiceModel.Syndication.SyndicationLink
          24 (29.27% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateSelfLink(System.Uri,System.String):System.ServiceModel.Syndication.SyndicationLink
           8 (25.81% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:.ctor(System.Uri):this
          16 (20.78% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateAlternateLink(System.Uri):System.ServiceModel.Syndication.SyndicationLink
          16 (20.78% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:CreateSelfLink(System.Uri):System.ServiceModel.Syndication.SyndicationLink
          46 (12.11% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.ActiveDirectorySite:GetComputerSite():System.DirectoryServices.ActiveDirectory.ActiveDirectorySite
         102 (10.11% of base) : FSharp.Core.dasm - HashCompare:GenericEqualityArbArray(bool,System.Collections.IEqualityComparer,System.Array,System.Array):bool
          20 ( 9.66% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationItem:AddPermalink(System.Uri):this
          50 ( 8.55% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.Domain:CreateLocalSideOfTrustRelationship(System.String,int,System.String):this
          50 ( 8.47% of base) : System.DirectoryServices.dasm - System.DirectoryServices.ActiveDirectory.Forest:CreateLocalSideOfTrustRelationship(System.String,int,System.String):this
          16 ( 6.50% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationItem:.ctor(System.String,System.ServiceModel.Syndication.SyndicationContent,System.Uri,System.String,System.DateTimeOffset):this
          71 ( 6.32% of base) : FSharp.Core.dasm - HashCompare:GenericComparisonArbArrayWithComparer(GenericComparer,System.Array,System.Array):int
          16 ( 5.26% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationFeed:.ctor(System.String,System.String,System.Uri,System.String,System.DateTimeOffset,System.Collections.Generic.IEnumerable`1[[System.ServiceModel.Syndication.SyndicationItem, System.ServiceModel.Syndication, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]]):this
          50 ( 2.67% of base) : System.Net.WebSockets.dasm - <WaitForServerToCloseConnectionAsync>d__68:MoveNext():this
          10 ( 1.33% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationFeed:TryReadTextInputFromExtension(System.ServiceModel.Syndication.SyndicationElementExtensionCollection):System.ServiceModel.Syndication.SyndicationTextInput:this
          32 ( 0.74% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.Rss20FeedFormatter:ReadItemFrom(System.Xml.XmlReader,System.ServiceModel.Syndication.SyndicationItem,System.Uri):this
          72 ( 0.46% of base) : System.Net.Http.dasm - <SendAsyncCore>d__56:MoveNext():this
           2 ( 0.09% of base) : System.Data.Odbc.dasm - System.Data.Odbc.OdbcDataReader:GetSchemaTable():System.Data.DataTable:this

Top method improvements (percentages):
        -103 (-100.00% of base) : Microsoft.CodeAnalysis.dasm - Microsoft.CodeAnalysis.SmallDictionary`2[__Canon,TargetScope][System.__Canon,Microsoft.CodeAnalysis.Diagnostics.SuppressMessageAttributeState+TargetScope]:LeftComplex(AvlNode[__Canon,TargetScope]):AvlNode[__Canon,TargetScope] (1 base, 0 diff methods)
          -6 (-18.18% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationLink:.ctor():this
         -22 (-17.19% of base) : System.Private.CoreLib.dasm - System.Convert:ToDateTime(System.String):System.DateTime
         -10 (-16.67% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationFeed:CreateLink():System.ServiceModel.Syndication.SyndicationLink:this
         -10 (-16.67% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.SyndicationItem:CreateLink():System.ServiceModel.Syndication.SyndicationLink:this
         -22 (-16.06% of base) : System.Private.CoreLib.dasm - System.Convert:ToDateTime(System.String,System.IFormatProvider):System.DateTime
         -49 (-4.16% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Vector`1][System.Numerics.Vector`1[System.Single]]:TryReadTo(byref,System.ReadOnlySpan`1[Vector`1],bool):bool:this (2 methods)
        -478 (-3.37% of base) : System.Formats.Asn1.dasm - System.Formats.Asn1.AsnWriter:WriteGeneralizedTimeCore(System.Formats.Asn1.Asn1Tag,System.DateTimeOffset,bool):this
         -23 (-2.06% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Byte][System.Byte]:TryReadTo(byref,System.ReadOnlySpan`1[Byte],bool):bool:this (2 methods)
         -23 (-2.05% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Double][System.Double]:TryReadTo(byref,System.ReadOnlySpan`1[Double],bool):bool:this (2 methods)
         -23 (-2.05% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Int16][System.Int16]:TryReadTo(byref,System.ReadOnlySpan`1[Int16],bool):bool:this (2 methods)
         -23 (-2.05% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Int32][System.Int32]:TryReadTo(byref,System.ReadOnlySpan`1[Int32],bool):bool:this (2 methods)
         -23 (-2.05% of base) : System.Memory.dasm - System.Buffers.SequenceReader`1[Int64][System.Int64]:TryReadTo(byref,System.ReadOnlySpan`1[Int64],bool):bool:this (2 methods)
         -34 (-0.35% of base) : System.Formats.Asn1.dasm - System.Formats.Asn1.AsnWriter:WriteUtcTimeCore(System.Formats.Asn1.Asn1Tag,System.DateTimeOffset):this
          -2 (-0.28% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.Rss20FeedFormatter:ReadAlternateLink(System.Xml.XmlReader,System.Uri,System.ServiceModel.Syndication.TryParseUriCallback,bool):System.ServiceModel.Syndication.SyndicationLink
          -2 (-0.16% of base) : System.ServiceModel.Syndication.dasm - System.ServiceModel.Syndication.Rss20FeedFormatter:ReadMediaEnclosure(System.Xml.XmlReader,System.Uri):System.ServiceModel.Syndication.SyndicationLink:this

35 total methods with Code Size differences (16 improved, 19 regressed), 345692 unchanged.

I guess this is just one manifestation of a more general problem that could occur with any foldable argument node. I am not sure what the appropriate place would be to fix this, or if it is even worth fixing at all (Compiler::gtFoldExprConst looks like an expensive function), and so have filed this issue.

Edit: area-System.ServiceModel.Syndication is probably not the right label 😄.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions