JIT: streamline temp usage for returns by AndyAyersMS · Pull Request #20640 · dotnet/coreclr (original) (raw)

This was originally needed for devirtualizing ArrayPool<T>.Shared.Rent but other jit changes have taken care of that. But it still has some benefit on its own.

Diffs generally favorable; often better spill placement (one spill below a join instead of two spills above).

The one big regression is in a method where inlining halts because of too many local vars. Since we've reduced temp usage somewhat we now do more inlines before we hit the limit.

Total bytes of diff: -227 (0.00% of base)
    diff is an improvement.

Top file regressions by size (bytes):
          47 : Microsoft.CodeAnalysis.VisualBasic.dasm (0.00% of base)
          42 : Microsoft.DotNet.ProjectModel.dasm (0.02% of base)
          31 : System.Private.Xml.dasm (0.00% of base)
          19 : Microsoft.CodeAnalysis.dasm (0.00% of base)
           6 : System.Data.Common.dasm (0.00% of base)

Top file improvements by size (bytes):
        -237 : Microsoft.CodeAnalysis.CSharp.dasm (-0.01% of base)
        -105 : System.Private.DataContractSerialization.dasm (-0.01% of base)
         -13 : System.Collections.dasm (0.00% of base)
         -11 : Microsoft.CSharp.dasm (0.00% of base)
         -11 : NuGet.Packaging.dasm (-0.01% of base)

13 total files with size differences (6 improved, 7 regressed), 116 unchanged.

Top method regressions by size (bytes):
         569 ( 3.34% of base) : Microsoft.CodeAnalysis.VisualBasic.dasm - Binder:ReportOverloadResolutionFailureForASingleCandidate(ref,ref,int,byref,struct,struct,bool,bool,bool,bool,ref,ref,bool,ref,ref):this
          36 ( 0.62% of base) : Microsoft.DotNet.ProjectModel.dasm - LibraryManager:GetAllDiagnostics():ref:this
          25 ( 0.98% of base) : System.Private.Xml.dasm - SchemaCollectionCompiler:CompileAttribute(ref):this
          15 ( 0.09% of base) : System.Private.Xml.dasm - XmlReflectionImporter:ImportAccessorMapping(ref,ref,ref,ref,ref,bool,bool,ref):this
           6 ( 0.26% of base) : System.Data.Common.dasm - XSDSchema:HandleRelation(ref,bool):this

Top method improvements by size (bytes):
         -91 (-0.87% of base) : Microsoft.CodeAnalysis.CSharp.dasm - SourceMemberContainerTypeSymbol:AddNonTypeMembers(ref,struct,ref):this
         -60 (-0.53% of base) : Microsoft.CodeAnalysis.VisualBasic.dasm - SourceMemberFieldSymbol:Create(ref,ref,ref,ref,byref,byref,ref)
         -49 (-0.53% of base) : Microsoft.CodeAnalysis.VisualBasic.dasm - Binder:DecodeParameterList(ref,bool,int,struct,ref,ref,ref):this
         -30 (-0.79% of base) : System.Private.DataContractSerialization.dasm - XmlBinaryReader:ReadArray(ref,ref,ref,int,int):int:this (20 methods)
         -30 (-1.23% of base) : System.Private.DataContractSerialization.dasm - XmlDictionaryReader:ReadArray(ref,ref,ref,int,int):int:this (20 methods)

Top method regressions by size (percentage):
         569 ( 3.34% of base) : Microsoft.CodeAnalysis.VisualBasic.dasm - Binder:ReportOverloadResolutionFailureForASingleCandidate(ref,ref,int,byref,struct,struct,bool,bool,bool,bool,ref,ref,bool,ref,ref):this
           3 ( 1.61% of base) : Microsoft.DotNet.ProjectModel.dasm - PatternContextLinear:CalculateStem(ref):ref:this
           3 ( 1.58% of base) : Microsoft.DotNet.ProjectModel.dasm - PatternContextRagged:CalculateStem(ref):ref:this
           4 ( 1.40% of base) : Microsoft.CodeAnalysis.dasm - LocalSlotManager:AllocateSlot(ref,ubyte,struct):ref:this
           2 ( 1.32% of base) : Microsoft.CodeAnalysis.dasm - LocalSlotManager:FreeSlot(ref):this

Top method improvements by size (percentage):
          -3 (-6.12% of base) : System.Private.DataContractSerialization.dasm - XmlDictionaryReader:GetAttribute(ref,ref):ref:this
          -3 (-5.77% of base) : System.Private.DataContractSerialization.dasm - XmlDictionaryReader:IsStartElement(ref,ref):bool:this
          -9 (-4.29% of base) : Microsoft.CodeAnalysis.VisualBasic.dasm - Scanner:XmlMakeEndEmbeddedToken(struct,ref):ref:this
          -2 (-4.08% of base) : System.Private.DataContractSerialization.dasm - XmlDictionaryWriter:WriteStartElement(ref,ref,ref):this
          -2 (-4.08% of base) : System.Private.DataContractSerialization.dasm - XmlDictionaryWriter:WriteStartAttribute(ref,ref,ref):this

160 total methods with size differences (138 improved, 22 regressed), 192533 unchanged.

cc @dotnet/jit-contrib