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

Optimize CAST(int <- long) on 32 bit targets #53040

Merged
merged 9 commits into from
Jun 25, 2021

Conversation

SingleAccretion
Copy link
Contributor

@SingleAccretion SingleAccretion commented May 20, 2021

Simple optimization in decomposition: throw away the high parts of casts from GT_LONGs to smaller types (right now it will only find casts to ints because morph "decomposes" CAST(small type <- long) to CAST(small type <- CAST(int <- long)), but the implementation handles both because it is trivial to do so).

Some pretty significant diffs for this change:

Windows x86
Running asm diffs of benchmarks.run.windows.x86.checked.mch

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 236586
Total bytes of diff: 233691
Total bytes of delta: -2895 (-1.22% of base)
    diff is an improvement.


Top method regressions (bytes):
          16 ( 4.64% of base) - System.Collections.BitArray:Not():System.Collections.BitArray:this
           9 ( 0.97% of base) - System.Text.Unicode.Utf16Utility:GetPointerToFirstInvalidChar(int,int,byref,byref):int
           1 ( 0.09% of base) - System.Text.Unicode.Utf8Utility:GetPointerToFirstInvalidByte(int,int,byref,byref):int

Top method improvements (bytes):
        -351 (-6.24% of base) - MessagePack.Formatters.DateTimeArrayFormatter:Serialize(byref,int,System.DateTime[],MessagePack.IFormatterResolver):int:this
        -338 (-18.74% of base) - ProtoBuf.ProtoReader:TryReadUInt64VariantWithoutMoving(byref):int:this
        -254 (-3.31% of base) - MessagePack.Formatters.DateTimeOffsetFormatter:Serialize(byref,int,System.DateTimeOffset,MessagePack.IFormatterResolver):int:this
        -210 (-6.30% of base) - System.Uri:CheckAuthorityHelper(int,int,int,byref,byref,System.UriParser,byref):int:this
         -91 (-15.02% of base) - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstCharToEncode(System.ReadOnlySpan`1[Char]):int:this
         -50 (-14.88% of base) - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstByteToEncodeSsse3(int,int):int:this
         -48 (-6.16% of base) - ProtoBuf.ProtoWriter:WriteInt64(long,ProtoBuf.ProtoWriter)
         -48 (-5.42% of base) - System.Buffers.Binary.Tests.BinaryReadAndWriteTests:GetSpanBE():System.Span`1[Byte]
         -45 (-12.26% of base) - System.Text.Latin1Utility:WidenLatin1ToUtf16_Sse2(int,int,int)
         -43 (-4.10% of base) - System.Threading.LowLevelLifoSemaphore:Wait(int,bool):bool:this
         -41 (-10.88% of base) - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstCharToEncodeSsse3(int,int):int:this
         -32 (-3.71% of base) - System.Globalization.TextInfo:ChangeCaseCommon(byref,byref,int):this
         -32 (-7.57% of base) - System.Text.ASCIIUtility:WidenAsciiToUtf16(int,int,int):int
         -32 (-1.37% of base) - DecCalc:DecAddSub(byref,byref,bool)
         -31 (-8.12% of base) - System.Sha1ForNonSecretPurposes:Finish(System.Span`1[Byte]):this
         -29 (-14.80% of base) - System.Reflection.Metadata.MetadataReader:ComputeCodedTokenSize(int,System.Int32[],long):int:this
         -29 (-7.18% of base) - System.Threading.LowLevelLifoSemaphore:Release(int):this
         -29 (-4.80% of base) - System.Text.ASCIIUtility:NarrowUtf16ToAscii(int,int,int):int
         -28 (-0.08% of base) - DynamicClass:_DynamicMethod0(System.IO.TextWriter,MicroBenchmarks.Serializers.MyEventsListerItem,int)
         -28 (-0.85% of base) - DecCalc:VarDecDiv(byref,byref)

Top method regressions (percentages):
          16 ( 4.64% of base) - System.Collections.BitArray:Not():System.Collections.BitArray:this
           9 ( 0.97% of base) - System.Text.Unicode.Utf16Utility:GetPointerToFirstInvalidChar(int,int,byref,byref):int
           1 ( 0.09% of base) - System.Text.Unicode.Utf8Utility:GetPointerToFirstInvalidByte(int,int,byref,byref):int

Top method improvements (percentages):
         -18 (-22.78% of base) - System.IO.Strategies.FileStreamHelpers:Unlock(Microsoft.Win32.SafeHandles.SafeFileHandle,System.String,long,long)
         -18 (-22.78% of base) - System.IO.Strategies.FileStreamHelpers:Lock(Microsoft.Win32.SafeHandles.SafeFileHandle,System.String,long,long)
        -338 (-18.74% of base) - ProtoBuf.ProtoReader:TryReadUInt64VariantWithoutMoving(byref):int:this
         -91 (-15.02% of base) - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstCharToEncode(System.ReadOnlySpan`1[Char]):int:this
         -50 (-14.88% of base) - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstByteToEncodeSsse3(int,int):int:this
         -29 (-14.80% of base) - System.Reflection.Metadata.MetadataReader:ComputeCodedTokenSize(int,System.Int32[],long):int:this
         -12 (-14.63% of base) - System.Numerics.Tests.Perf_BitOperations:PopCount_ulong():int:this
          -4 (-14.29% of base) - System.String:IsCharBitSet(int,ubyte):bool
         -12 (-13.19% of base) - System.Numerics.Tests.Perf_BitOperations:LeadingZeroCount_ulong():int:this
          -3 (-13.04% of base) - System.Uri:EnsureParseRemaining():this
         -17 (-12.98% of base) - System.IPv4AddressHelper:Parse(System.String,int,int,int):bool
         -14 (-12.84% of base) - System.Numerics.Tests.Perf_BitOperations:Log2_ulong():int:this
          -4 (-12.50% of base) - BigInteger:CountSignificantBits(byref):int
         -45 (-12.26% of base) - System.Text.Latin1Utility:WidenLatin1ToUtf16_Sse2(int,int,int)
         -41 (-10.88% of base) - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstCharToEncodeSsse3(int,int):int:this
          -3 (-8.57% of base) - System.Uri:EnsureUriInfo():UriInfo:this
         -31 (-8.12% of base) - System.Sha1ForNonSecretPurposes:Finish(System.Span`1[Byte]):this
          -5 (-7.94% of base) - System.IO.Strategies.SyncWindowsFileStreamStrategy:GetNativeOverlappedForCurrentPosition():System.Threading.NativeOverlapped:this
          -5 (-7.94% of base) - System.DateTimeOffset:GetHashCode():int:this
         -11 (-7.86% of base) - System.Text.Encodings.Web.TextEncoderSettings:AllowRange(System.Text.Unicode.UnicodeRange):this

195 total methods with Code Size differences (192 improved, 3 regressed), 7 unchanged.

Running asm diffs of coreclr_tests.pmi.windows.x86.checked.mch

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 452736
Total bytes of diff: 432163
Total bytes of delta: -20573 (-4.54% of base)
    diff is an improvement.


Top method regressions (bytes):
           4 ( 6.56% of base) - CommandBytes:GetHashCode():int:this

Top method improvements (bytes):
       -1790 (-8.35% of base) - DevDiv_545504:test(int):long
        -170 (-5.34% of base) - Struct_512bytes:Compute():long:this
         -72 (-2.16% of base) - GCSimulator.ClientSimulator:RunTest()
         -48 (-4.13% of base) - VectorConvertTest:VectorConvertInt64And32(System.Numerics.Vector`1[Int64],System.Numerics.Vector`1[Int64]):int
         -48 (-4.12% of base) - VectorConvertTest:VectorConvertUInt64And32(System.Numerics.Vector`1[UInt64],System.Numerics.Vector`1[UInt64]):int
         -48 (-4.13% of base) - VectorConvertTest:VectorConvertInt64And32(System.Numerics.Vector`1[Int64],System.Numerics.Vector`1[Int64]):int
         -48 (-4.12% of base) - VectorConvertTest:VectorConvertUInt64And32(System.Numerics.Vector`1[UInt64],System.Numerics.Vector`1[UInt64]):int
         -32 (-7.57% of base) - System.Text.ASCIIUtility:WidenAsciiToUtf16(int,int,int):int
         -29 (-4.80% of base) - System.Text.ASCIIUtility:NarrowUtf16ToAscii(int,int,int):int
         -28 (-0.35% of base) - TestApp:Main():int
         -21 (-0.26% of base) - TestApp:Main():int
         -21 (-0.27% of base) - TestApp:Main():int
         -17 (-0.84% of base) - ILGEN_0xdea951c0:Method_0x5a7bd7a1(long,short,byte,ubyte,int,int,ushort,int,int):double
         -16 (-0.20% of base) - TestApp:Main():int
         -14 (-5.56% of base) - JIT.HardwareIntrinsics.X86.ScalarUnaryOpTest__TrailingZeroCountUInt64:ValidateResult(long,long,System.String):this
         -14 (-0.18% of base) - TestApp:Main():int
         -12 (-1.83% of base) - System.SpanHelpers:IndexOf(byref,ushort,int):int
         -12 (-52.17% of base) - TestApp:test_185(int):long
         -12 (-52.17% of base) - TestApp:test_263(int):long
         -12 (-52.17% of base) - TestApp:test_341(int):long

Top method regressions (percentages):
           4 ( 6.56% of base) - CommandBytes:GetHashCode():int:this

Top method improvements (percentages):
         -12 (-52.17% of base) - TestApp:test_185(int):long
         -12 (-52.17% of base) - TestApp:test_263(int):long
         -12 (-52.17% of base) - TestApp:test_341(int):long
         -12 (-52.17% of base) - TestApp:test_68(int):long
         -12 (-52.17% of base) - TestApp:test_29(int):long
         -12 (-52.17% of base) - TestApp:test_107(int):long
          -8 (-44.44% of base) - Test:Foo(int):int
          -6 (-35.29% of base) - TestApp:test_302(int):long
          -7 (-28.00% of base) - Internal.NativeFormat.TypeHashingAlgorithms:ComputeArrayTypeHashCode(long,int):int
          -7 (-23.33% of base) - Internal.NativeFormat.TypeHashingAlgorithms:ComputePointerTypeHashCode(long):int
          -7 (-23.33% of base) - Internal.NativeFormat.TypeHashingAlgorithms:ComputeByrefTypeHashCode(long):int
          -7 (-21.21% of base) - TestApp:test_312(long,long):long
          -7 (-17.95% of base) - TestApp:test_117(long,long):long
          -7 (-17.95% of base) - TestApp:test_195(long,long):long
          -7 (-17.95% of base) - TestApp:test_273(long,long):long
          -7 (-17.95% of base) - TestApp:test_351(long,long):long
          -7 (-17.95% of base) - TestApp:test_78(long,long):long
          -4 (-16.67% of base) - DataTable:Align(int,long):int
          -4 (-13.79% of base) - _simple:main(System.String[]):int
          -4 (-13.79% of base) - ILGEN_0x71d10697:Main():int

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

Running asm diffs of libraries.crossgen.windows.x86.checked.mch

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 240888
Total bytes of diff: 236769
Total bytes of delta: -4119 (-1.71% of base)
    diff is an improvement.


Top method regressions (bytes):
          32 ( 3.01% of base) - ILCompiler.Reflection.ReadyToRun.Amd64.GcInfo:GetLiveSlotsAtSafepoints(System.Byte[],byref):System.Collections.Generic.List`1[[System.Collections.Generic.List`1[[ILCompiler.Reflection.ReadyToRun.BaseGcSlot, ILCompiler.Reflection.ReadyToRun, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]:this
           9 ( 4.71% of base) - System.Reflection.Metadata.MetadataReader:ComputeCodedTokenSize(int,System.Int32[],long):int:this
           9 ( 3.20% of base) - System.Runtime.InteropServices.SafeBuffer:ReadSpan(long,System.Span`1[__Canon]):this
           7 ( 0.39% of base) - Microsoft.Cci.PeWriter:WriteDirectory(Directory,Microsoft.Cci.BlobBuilder,int,int,int,int,Microsoft.Cci.BlobBuilder):this

Top method improvements (bytes):
        -215 (-6.38% of base) - System.Uri:CheckAuthorityHelper(int,int,int,byref,byref,System.UriParser,byref):int:this
         -91 (-9.84% of base) - BigNumber:Mul(byref):this
         -66 (-3.20% of base) - System.Data.SqlTypes.SqlDecimal:MpDiv(System.ReadOnlySpan`1[UInt32],int,System.Span`1[UInt32],int,System.Span`1[UInt32],byref,System.Span`1[UInt32],byref)
         -54 (-5.03% of base) - <PgoEncodedCompressedLongGenerator>d__5:MoveNext():bool:this
         -50 (-21.65% of base) - Newtonsoft.Json.Bson.AsyncBinaryWriter:WriteAsync(long,System.Threading.CancellationToken):System.Threading.Tasks.Task:this
         -46 (-5.81% of base) - Newtonsoft.Json.Utilities.JavaScriptUtils:TryGetDateFromConstructorJson(Newtonsoft.Json.JsonReader,byref,byref):bool
         -45 (-11.81% of base) - System.Text.Latin1Utility:WidenLatin1ToUtf16_Sse2(int,int,int)
         -43 (-3.84% of base) - System.Threading.LowLevelLifoSemaphore:Wait(int,bool):bool:this
         -36 (-3.64% of base) - System.Globalization.TextInfo:ChangeCaseCommon(byref,byref,int):this
         -33 (-3.30% of base) - System.Globalization.TextInfo:ChangeCaseCommon(byref,byref,int):this
         -32 (-1.34% of base) - DecCalc:DecAddSub(byref,byref,bool)
         -32 (-1.54% of base) - System.Numerics.Matrix4x4:Decompose(System.Numerics.Matrix4x4,byref,byref,byref):bool
         -32 (-4.22% of base) - System.PercentEncodingHelper:UnescapePercentEncodedUTF8Sequence(int,int,byref,bool,bool):int
         -32 (-3.48% of base) - DecCalc:ScaleResult(int,int,int):int
         -31 (-7.91% of base) - System.Sha1ForNonSecretPurposes:Finish(System.Span`1[Byte]):this
         -29 (-6.81% of base) - System.Threading.LowLevelLifoSemaphore:Release(int):this
         -28 (-0.85% of base) - DecCalc:VarDecDiv(byref,byref)
         -27 (-5.06% of base) - System.Xml.Schema.XsdDuration:.ctor(System.TimeSpan,int):this
         -25 (-3.40% of base) - Microsoft.CodeAnalysis.EnumConstantHelper:OffsetValue(Microsoft.CodeAnalysis.ConstantValue,int,byref):int
         -23 (-0.93% of base) - Microsoft.Diagnostics.Tracing.Etlx.TraceLoadedModules:ImageLoadOrUnload(Microsoft.Diagnostics.Tracing.Parsers.Kernel.ImageLoadTraceData,bool,System.String):Microsoft.Diagnostics.Tracing.Etlx.TraceModuleFile:this

Top method regressions (percentages):
           9 ( 4.71% of base) - System.Reflection.Metadata.MetadataReader:ComputeCodedTokenSize(int,System.Int32[],long):int:this
           9 ( 3.20% of base) - System.Runtime.InteropServices.SafeBuffer:ReadSpan(long,System.Span`1[__Canon]):this
          32 ( 3.01% of base) - ILCompiler.Reflection.ReadyToRun.Amd64.GcInfo:GetLiveSlotsAtSafepoints(System.Byte[],byref):System.Collections.Generic.List`1[[System.Collections.Generic.List`1[[ILCompiler.Reflection.ReadyToRun.BaseGcSlot, ILCompiler.Reflection.ReadyToRun, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]:this
           7 ( 0.39% of base) - Microsoft.Cci.PeWriter:WriteDirectory(Directory,Microsoft.Cci.BlobBuilder,int,int,int,int,Microsoft.Cci.BlobBuilder):this

Top method improvements (percentages):
          -4 (-40.00% of base) - System.UInt64:GetHashCode():int:this
          -4 (-40.00% of base) - Counts:GetHashCode():int:this
          -4 (-40.00% of base) - ThreadCounts:GetHashCode():int:this
          -2 (-40.00% of base) - IntPtrIEquality@2042:System.Collections.Generic.IEqualityComparer<System.IntPtr>.GetHashCode(int):int:this
          -7 (-38.89% of base) - System.Collections.Generic.GenericEqualityComparer`1[Int64][System.Int64]:GetHashCode(long):int:this
          -7 (-38.89% of base) - Int64IEquality@2041:System.Collections.Generic.IEqualityComparer<System.Int64>.GetHashCode(long):int:this
          -5 (-38.46% of base) - System.TimeOnly:GetHashCode():int:this
          -5 (-38.46% of base) - System.Int64:GetHashCode():int:this
          -5 (-38.46% of base) - System.TimeSpan:GetHashCode():int:this
          -9 (-33.33% of base) - Interop:SplitLong(long,byref,byref)
          -6 (-31.58% of base) - System.Reflection.Metadata.Ecma335.TokenTypeIds:IsValidRowId(int):bool
          -6 (-28.57% of base) - System.Data.SqlTypes.SqlInt32:SameSignInt(int,int):bool
          -2 (-25.00% of base) - System.Xml.Xsl.Location:get_Line():int:this
          -5 (-25.00% of base) - PEFile.IMAGE_RESOURCE_DIRECTORY_ENTRY:get_IsLeaf():bool:this
          -9 (-24.32% of base) - System.DirectoryServices.Interop.AdsValueHelper:set_LowInt64(long):this
          -5 (-22.73% of base) - System.DateTime:GetHashCode():int:this
          -2 (-22.22% of base) - System.Data.SqlTypes.SqlDecimal:HI(long):int
         -18 (-21.95% of base) - System.IO.Strategies.FileStreamHelpers:Lock(Microsoft.Win32.SafeHandles.SafeFileHandle,System.String,long,long)
         -18 (-21.95% of base) - System.IO.Strategies.FileStreamHelpers:Unlock(Microsoft.Win32.SafeHandles.SafeFileHandle,System.String,long,long)
          -9 (-21.95% of base) - System.Math:Sign(long):int

596 total methods with Code Size differences (592 improved, 4 regressed), 4 unchanged.

Running asm diffs of libraries.crossgen2.windows.x86.checked.mch

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 254640
Total bytes of diff: 250170
Total bytes of delta: -4470 (-1.76% of base)
    diff is an improvement.


Top method regressions (bytes):
          32 ( 3.01% of base) - ILCompiler.Reflection.ReadyToRun.Amd64.GcInfo:GetLiveSlotsAtSafepoints(System.Byte[],byref):System.Collections.Generic.List`1[System.Collections.Generic.List`1[ILCompiler.Reflection.ReadyToRun.BaseGcSlot]]:this
           9 ( 4.69% of base) - System.Reflection.Metadata.MetadataReader:ComputeCodedTokenSize(int,System.Int32[],long):int:this
           7 ( 0.32% of base) - Microsoft.Cci.PeWriter:WriteDirectory(Microsoft.Cci.PeWriter+Directory,Microsoft.Cci.BlobBuilder,int,int,int,int,Microsoft.Cci.BlobBuilder):this

Top method improvements (bytes):
        -215 (-6.38% of base) - System.Uri:CheckAuthorityHelper(int,int,int,byref,byref,System.UriParser,byref):int:this
         -95 (-15.32% of base) - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstCharToEncode(System.ReadOnlySpan`1[System.Char]):int:this
         -91 (-9.84% of base) - BigNumber:Mul(byref):this
         -78 (-3.65% of base) - System.Data.SqlTypes.SqlDecimal:MpDiv(System.ReadOnlySpan`1[System.UInt32],int,System.Span`1[System.UInt32],int,System.Span`1[System.UInt32],byref,System.Span`1[System.UInt32],byref)
         -54 (-5.03% of base) - <PgoEncodedCompressedLongGenerator>d__5:MoveNext():bool:this
         -54 (-5.03% of base) - <PgoEncodedCompressedLongGenerator>d__5:MoveNext():bool:this
         -50 (-21.55% of base) - Newtonsoft.Json.Bson.AsyncBinaryWriter:WriteAsync(long,System.Threading.CancellationToken):System.Threading.Tasks.Task:this
         -50 (-14.20% of base) - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstByteToEncodeSsse3(int,int):int:this
         -46 (-5.81% of base) - Newtonsoft.Json.Utilities.JavaScriptUtils:TryGetDateFromConstructorJson(Newtonsoft.Json.JsonReader,byref,byref):bool
         -45 (-11.81% of base) - System.Text.Latin1Utility:WidenLatin1ToUtf16_Sse2(int,int,int)
         -44 (-2.20% of base) - System.Resources.ResourceWriter:Generate():this
         -44 (-2.19% of base) - System.Resources.Extensions.PreserializedResourceWriter:Generate():this
         -43 (-3.84% of base) - System.Threading.LowLevelLifoSemaphore:Wait(int,bool):bool:this
         -36 (-3.64% of base) - System.Globalization.TextInfo:ChangeCaseCommon(byref,byref,int):this
         -33 (-15.28% of base) - ILCompiler.PEWriter.RelocationHelper:WriteUInt64(long,System.Byte[],int)
         -32 (-1.34% of base) - DecCalc:DecAddSub(byref,byref,bool)
         -32 (-3.53% of base) - DecCalc:ScaleResult(int,int,int):int
         -32 (-4.35% of base) - System.PercentEncodingHelper:UnescapePercentEncodedUTF8Sequence(int,int,byref,bool,bool):int
         -31 (-7.89% of base) - System.Sha1ForNonSecretPurposes:Finish(System.Span`1[System.Byte]):this
         -29 (-6.81% of base) - System.Threading.LowLevelLifoSemaphore:Release(int):this

Top method regressions (percentages):
           9 ( 4.69% of base) - System.Reflection.Metadata.MetadataReader:ComputeCodedTokenSize(int,System.Int32[],long):int:this
          32 ( 3.01% of base) - ILCompiler.Reflection.ReadyToRun.Amd64.GcInfo:GetLiveSlotsAtSafepoints(System.Byte[],byref):System.Collections.Generic.List`1[System.Collections.Generic.List`1[ILCompiler.Reflection.ReadyToRun.BaseGcSlot]]:this
           7 ( 0.32% of base) - Microsoft.Cci.PeWriter:WriteDirectory(Microsoft.Cci.PeWriter+Directory,Microsoft.Cci.BlobBuilder,int,int,int,int,Microsoft.Cci.BlobBuilder):this

Top method improvements (percentages):
          -2 (-40.00% of base) - IntPtrIEquality@2042:System.Collections.Generic.IEqualityComparer<System.IntPtr>.GetHashCode(int):int:this
          -4 (-40.00% of base) - Counts:GetHashCode():int:this
          -4 (-40.00% of base) - ThreadCounts:GetHashCode():int:this
          -4 (-40.00% of base) - System.UInt64:GetHashCode():int:this
          -7 (-38.89% of base) - Int64IEquality@2041:System.Collections.Generic.IEqualityComparer<System.Int64>.GetHashCode(long):int:this
          -5 (-38.46% of base) - System.TimeOnly:GetHashCode():int:this
          -5 (-38.46% of base) - System.TimeSpan:GetHashCode():int:this
          -5 (-38.46% of base) - System.Int64:GetHashCode():int:this
          -9 (-33.33% of base) - Interop:SplitLong(long,byref,byref)
          -6 (-31.58% of base) - System.Reflection.Metadata.Ecma335.TokenTypeIds:IsValidRowId(int):bool
          -6 (-28.57% of base) - System.Data.SqlTypes.SqlInt32:SameSignInt(int,int):bool
         -12 (-27.27% of base) - System.ValueTuple`2:GetHashCode():int:this
          -2 (-25.00% of base) - System.Xml.Xsl.Location:get_Line():int:this
          -5 (-25.00% of base) - PEFile.IMAGE_RESOURCE_DIRECTORY_ENTRY:get_IsLeaf():bool:this
          -9 (-24.32% of base) - System.DirectoryServices.Interop.AdsValueHelper:set_LowInt64(long):this
          -5 (-22.73% of base) - System.DateTime:GetHashCode():int:this
          -2 (-22.22% of base) - System.Data.SqlTypes.SqlDecimal:HI(long):int
          -9 (-21.95% of base) - System.Math:Sign(long):int
         -18 (-21.69% of base) - System.IO.Strategies.FileStreamHelpers:Unlock(Microsoft.Win32.SafeHandles.SafeFileHandle,System.String,long,long)
         -18 (-21.69% of base) - System.IO.Strategies.FileStreamHelpers:Lock(Microsoft.Win32.SafeHandles.SafeFileHandle,System.String,long,long)

621 total methods with Code Size differences (618 improved, 3 regressed), 4 unchanged.

Running asm diffs of libraries.pmi.windows.x86.checked.mch

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 220677
Total bytes of diff: 216948
Total bytes of delta: -3729 (-1.69% of base)
    diff is an improvement.


Top method regressions (bytes):
          16 ( 4.64% of base) - System.Collections.BitArray:Not():System.Collections.BitArray:this
          13 ( 0.65% of base) - BigNumber:DblToRgbPrecise(double,System.Byte[],byref,byref)
           9 ( 4.52% of base) - System.Reflection.Metadata.MetadataReader:ComputeCodedTokenSize(int,System.Int32[],long):int:this
           8 ( 0.74% of base) - System.Security.Cryptography.Xml.SymmetricKeyWrap:AESKeyWrapDecrypt(System.Byte[],System.Byte[]):System.Byte[]
           8 ( 0.37% of base) - Microsoft.Cci.PeWriter:WriteDirectory(Directory,Microsoft.Cci.BlobBuilder,int,int,int,int,Microsoft.Cci.BlobBuilder):this
           3 ( 0.11% of base) - Microsoft.Diagnostics.Tracing.Parsers.MicrosoftWindowsNDISPacketCapture.PacketFragmentArgs:get_ParsedPacket():System.String:this
           3 ( 3.41% of base) - System.Linq.Parallel.HashLookup`2[Double,Nullable`1][System.Double,System.Nullable`1[System.Int32]]:GetKeyHashCode(double):int:this

Top method improvements (bytes):
        -210 (-6.30% of base) - System.Uri:CheckAuthorityHelper(int,int,int,byref,byref,System.UriParser,byref):int:this
         -91 (-9.84% of base) - BigNumber:Mul(byref):this
         -91 (-15.02% of base) - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstCharToEncode(System.ReadOnlySpan`1[Char]):int:this
         -68 (-3.00% of base) - System.Data.SqlTypes.SqlDecimal:MpDiv(System.ReadOnlySpan`1[UInt32],int,System.Span`1[UInt32],int,System.Span`1[UInt32],byref,System.Span`1[UInt32],byref)
         -54 (-5.04% of base) - <PgoEncodedCompressedLongGenerator>d__5:MoveNext():bool:this
         -50 (-14.88% of base) - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstByteToEncodeSsse3(int,int):int:this
         -46 (-20.91% of base) - Newtonsoft.Json.Bson.AsyncBinaryWriter:WriteAsync(long,System.Threading.CancellationToken):System.Threading.Tasks.Task:this
         -44 (-1.73% of base) - System.Resources.ResourceWriter:Generate():this
         -44 (-1.75% of base) - System.Resources.Extensions.PreserializedResourceWriter:Generate():this
         -41 (-10.88% of base) - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstCharToEncodeSsse3(int,int):int:this
         -34 (-0.83% of base) - System.Drawing.ColorConverter:ConvertTo(System.ComponentModel.ITypeDescriptorContext,System.Globalization.CultureInfo,System.Object,System.Type):System.Object:this
         -32 (-7.57% of base) - System.Text.ASCIIUtility:WidenAsciiToUtf16(int,int,int):int
         -29 (-4.80% of base) - System.Text.ASCIIUtility:NarrowUtf16ToAscii(int,int,int):int
         -27 (-3.00% of base) - System.Globalization.TextInfo:ChangeCaseCommon(byref,byref,int):this
         -26 (-4.28% of base) - System.Text.Latin1Utility:NarrowUtf16ToLatin1(int,int,int):int
         -25 (-3.81% of base) - System.PercentEncodingHelper:UnescapePercentEncodedUTF8Sequence(int,int,byref,bool,bool):int
         -25 (-4.84% of base) - System.Xml.Schema.XsdDuration:.ctor(System.TimeSpan,int):this
         -24 (-1.95% of base) - FloatingDecimal:AdjustDbl(double):double:this
         -21 (-1.86% of base) - System.Diagnostics.SharedPerformanceCounter:CreateInstance(int,int,System.String,int):int:this
         -20 (-2.68% of base) - System.Net.Http.Headers.CacheControlHeaderValue:GetHashCode():int:this

Top method regressions (percentages):
          16 ( 4.64% of base) - System.Collections.BitArray:Not():System.Collections.BitArray:this
           9 ( 4.52% of base) - System.Reflection.Metadata.MetadataReader:ComputeCodedTokenSize(int,System.Int32[],long):int:this
           3 ( 3.41% of base) - System.Linq.Parallel.HashLookup`2[Double,Nullable`1][System.Double,System.Nullable`1[System.Int32]]:GetKeyHashCode(double):int:this
           8 ( 0.74% of base) - System.Security.Cryptography.Xml.SymmetricKeyWrap:AESKeyWrapDecrypt(System.Byte[],System.Byte[]):System.Byte[]
          13 ( 0.65% of base) - BigNumber:DblToRgbPrecise(double,System.Byte[],byref,byref)
           8 ( 0.37% of base) - Microsoft.Cci.PeWriter:WriteDirectory(Directory,Microsoft.Cci.BlobBuilder,int,int,int,int,Microsoft.Cci.BlobBuilder):this
           3 ( 0.11% of base) - Microsoft.Diagnostics.Tracing.Parsers.MicrosoftWindowsNDISPacketCapture.PacketFragmentArgs:get_ParsedPacket():System.String:this

Top method improvements (percentages):
          -2 (-40.00% of base) - IntPtrIEquality@2042:System.Collections.Generic.IEqualityComparer<System.IntPtr>.GetHashCode(int):int:this
          -7 (-38.89% of base) - Int64IEquality@2041:System.Collections.Generic.IEqualityComparer<System.Int64>.GetHashCode(long):int:this
          -7 (-38.89% of base) - System.Collections.Generic.ObjectEqualityComparer`1[Int64][System.Int64]:GetHashCode(long):int:this
          -5 (-38.46% of base) - IdOfIncompleteAction:GetHashCode():int:this
          -5 (-38.46% of base) - System.Diagnostics.CounterSample:GetHashCode():int:this
          -5 (-38.46% of base) - Microsoft.DotNet.PlatformAbstractions.HashCodeCombiner:get_CombinedHash():int:this
          -5 (-38.46% of base) - Internal.Microsoft.DotNet.PlatformAbstractions.HashCodeCombiner:get_CombinedHash():int:this
          -9 (-33.33% of base) - Interop:SplitLong(long,byref,byref)
          -6 (-31.58% of base) - System.Reflection.Metadata.Ecma335.TokenTypeIds:IsValidRowId(int):bool
          -5 (-31.25% of base) - Microsoft.CodeAnalysis.SyntaxAnnotation:GetHashCode():int:this
          -7 (-30.43% of base) - System.HashCode:Add(long):this
          -7 (-29.17% of base) - InternTable`1[Int64][System.Int64]:BucketNumberFromValue(long,int):int
          -6 (-28.57% of base) - System.Data.SqlTypes.SqlInt32:SameSignInt(int,int):bool
          -7 (-28.00% of base) - Internal.NativeFormat.TypeHashingAlgorithms:ComputeArrayTypeHashCode(long,int):int
          -5 (-27.78% of base) - NonStructural@26[Int64][System.Int64]:System.Collections.Generic.IEqualityComparer<'T>.GetHashCode(long):int:this
          -5 (-27.78% of base) - NonStructuralComparison:Hash(long):int
          -7 (-25.93% of base) - System.DirectoryServices.Interop.AdsValueHelper:set_LowInt64(long):this
          -2 (-25.00% of base) - System.Xml.Xsl.Location:get_Line():int:this
          -5 (-25.00% of base) - PEFile.IMAGE_RESOURCE_DIRECTORY_ENTRY:get_IsLeaf():bool:this
          -7 (-23.33% of base) - Internal.NativeFormat.TypeHashingAlgorithms:ComputePointerTypeHashCode(long):int

518 total methods with Code Size differences (511 improved, 7 regressed), 8 unchanged.

Running asm diffs of libraries_tests.pmi.windows.x86.checked.mch

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 344593
Total bytes of diff: 339116
Total bytes of delta: -5477 (-1.59% of base)
    diff is an improvement.


Top method regressions (bytes):
           4 ( 2.96% of base) - System.IO.StringParser:ParseNextUInt32():int:this
           4 ( 2.96% of base) - System.IO.StringParser:ParseNextUInt32():int:this
           4 ( 2.96% of base) - System.IO.StringParser:ParseNextUInt32():int:this

Top method improvements (bytes):
        -114 (-1.54% of base) - MonoTests.System.Drawing.TestBitmap:FormatTest(int):this
        -114 (-1.48% of base) - System.Drawing.Tests.BitmapTests:CustomPixelFormat_GetPixels_ReturnsExpected(int):this
        -107 (-5.06% of base) - MonoTests.System.Drawing.Imaging.PngCodecTest:Bitmap4bitFeatures():this
        -104 (-4.16% of base) - System.Threading.Tasks.Tests.CancellationTokenTests:CancellationTokenRegistration_EqualityAndHashCode()
         -92 (-6.17% of base) - MonoTests.System.Drawing.Imaging.IconCodecTest:Bitmap16Features_Palette_Entries_Unix():this
         -92 (-6.17% of base) - MonoTests.System.Drawing.Imaging.IconCodecTest:Bitmap32Features_PaletteEntries_Unix():this
         -90 (-1.92% of base) - MonoTests.System.Drawing.TestBitmap:LockUnlockBitmap():this
         -62 (-1.51% of base) - System.Drawing.Tests.BitmapTests:LockBits_Marshalling_Success():this
         -60 (-4.07% of base) - System.Tests.TimeOnlyTests:AllCulturesTest()
         -51 (-10.71% of base) - System.Data.SqlClient.TdsParser:WriteLong(long,System.Data.SqlClient.TdsParserStateObject):this
         -51 (-10.71% of base) - System.Data.SqlClient.TdsParser:WriteLong(long,System.Data.SqlClient.TdsParserStateObject):this
         -48 (-4.86% of base) - System.TestHelpers:GetSpanBE():System.Span`1[Byte]
         -38 (-2.26% of base) - <Seek_RandomWalk_ReadConsistency>d__33:MoveNext():this
         -32 (-7.57% of base) - System.Text.ASCIIUtility:WidenAsciiToUtf16(int,int,int):int
         -30 (-4.06% of base) - System.Buffers.Binary.Tests.BinaryWriterUnitTests:SpanWriteDouble(double):this
         -29 (-4.80% of base) - System.Text.ASCIIUtility:NarrowUtf16ToAscii(int,int,int):int
         -29 (-10.10% of base) - System.Data.Tests.SqlTypes.SqlDateTimeTest:GetHashCodeTest():this
         -28 (-1.36% of base) - System.Tests.DateOnlyTests:AddMonthsTest()
         -28 (-1.30% of base) - System.Tests.DateOnlyTests:AddYearsTest()
         -27 (-2.43% of base) - System.Drawing.Primitives.Tests.ColorTests:FromArgb_Roundtrips(int,int,int,int):this

Top method regressions (percentages):
           4 ( 2.96% of base) - System.IO.StringParser:ParseNextUInt32():int:this
           4 ( 2.96% of base) - System.IO.StringParser:ParseNextUInt32():int:this
           4 ( 2.96% of base) - System.IO.StringParser:ParseNextUInt32():int:this

Top method improvements (percentages):
          -7 (-38.89% of base) - ReferenceEqualityComparer`1[Int64][System.Int64]:GetHashCode(long):int:this
          -5 (-38.46% of base) - Microsoft.DotNet.InternalAbstractions.HashCodeCombiner:get_CombinedHash():int:this
          -5 (-38.46% of base) - Humanizer.Bytes.ByteSize:GetHashCode():int:this
          -5 (-31.25% of base) - System.Collections.ObjectModel.Tests.KeyedItem`2[Byte,Int64][System.Byte,System.Int64]:GetHashCode():int:this
          -5 (-31.25% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -5 (-31.25% of base) - System.Collections.ObjectModel.Tests.KeyedItem`2[__Canon,Int64][System.__Canon,System.Int64]:GetHashCode():int:this
          -5 (-31.25% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -5 (-31.25% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -5 (-31.25% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -5 (-31.25% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -5 (-31.25% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -5 (-31.25% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -5 (-31.25% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -5 (-31.25% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -5 (-31.25% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -5 (-31.25% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -5 (-27.78% of base) - CustomComparer`1[Int64][System.Int64]:GetHashCode(long):int:this
          -7 (-25.93% of base) - System.Linq.Parallel.Tests.CancelingEqualityComparer`1[Int64][System.Int64]:GetHashCode(long):int:this
          -5 (-25.00% of base) - Microsoft.Diagnostics.Runtime.Utilities.IMAGE_RESOURCE_DIRECTORY_ENTRY:get_IsLeaf():bool:this
          -5 (-23.81% of base) - System.Collections.Tests.TrackingEqualityComparer`1[Int64][System.Int64]:GetHashCode(long):int:this

690 total methods with Code Size differences (687 improved, 3 regressed), 4 unchanged.
Linux ARM
Running asm diffs of coreclr_tests.pmi.Linux.arm.checked.mch

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 509564
Total bytes of diff: 489998
Total bytes of delta: -19566 (-3.84% of base)
    diff is an improvement.


Top file improvements (bytes):
       -2028 : 253542.dasm (-9.21% of base)
         -44 : 253546.dasm (-2.18% of base)
         -26 : 227149.dasm (-0.65% of base)
         -20 : 226104.dasm (-0.26% of base)
         -16 : 230034.dasm (-0.21% of base)
         -16 : 6.dasm (-3.46% of base)
         -14 : 228262.dasm (-0.19% of base)
         -12 : 252833.dasm (-0.54% of base)
         -12 : 28.dasm (-4.00% of base)
         -12 : 234200.dasm (-0.16% of base)
         -10 : 231624.dasm (-0.14% of base)
          -8 : 229342.dasm (-0.11% of base)
          -8 : 254689.dasm (-1.65% of base)
          -8 : 232224.dasm (-0.52% of base)
          -8 : 236420.dasm (-1.12% of base)
          -6 : 254295.dasm (-1.15% of base)
          -6 : 4.dasm (-1.64% of base)
          -6 : 82245.dasm (-30.00% of base)
          -6 : 86109.dasm (-2.21% of base)
          -6 : 86356.dasm (-2.44% of base)

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

Top method improvements (bytes):
       -2028 (-9.21% of base) - DevDiv_545504:test(int):long
         -44 (-2.18% of base) - Struct_512bytes:Compute():long:this
         -26 (-0.65% of base) - GCSimulator.ClientSimulator:RunTest()
         -20 (-0.26% of base) - TestApp:Main():int
         -16 (-0.21% of base) - TestApp:Main():int
         -16 (-3.46% of base) - System.Text.ASCIIUtility:NarrowUtf16ToAscii(int,int,int):int
         -14 (-0.19% of base) - TestApp:Main():int
         -12 (-0.54% of base) - ILGEN_0xdea951c0:Method_0x5a7bd7a1(long,short,byte,ubyte,int,int,ushort,int,int):double
         -12 (-4.00% of base) - System.Text.ASCIIUtility:WidenAsciiToUtf16(int,int,int):int
         -12 (-0.16% of base) - TestApp:Main():int
         -10 (-0.14% of base) - TestApp:Main():int
          -8 (-0.11% of base) - TestApp:Main():int
          -8 (-1.65% of base) - Test:Main():int
          -8 (-0.52% of base) - StressAllocator.StressAllocator:OutputGCStats(int)
          -8 (-1.12% of base) - BinaryPrimitivesReverseEndianness.Program:Main(System.String[]):int
          -6 (-1.15% of base) - Test:Main():int
          -6 (-1.64% of base) - System.Text.Unicode.Utf16Utility:GetPointerToFirstInvalidChar(int,int,byref,byref):int
          -6 (-30.00% of base) - Test:Foo(int):int
          -6 (-2.21% of base) - ILGEN_622380794:main():int
          -6 (-2.44% of base) - ILGEN_622380794:main():int

Top method improvements (percentages):
          -6 (-30.00% of base) - Test:Foo(int):int
          -2 (-12.50% of base) - TestApp:test_302(int):long
          -2 (-12.50% of base) - TestApp:test_29(int):long
          -2 (-12.50% of base) - TestApp:test_185(int):long
          -2 (-12.50% of base) - TestApp:test_341(int):long
          -2 (-12.50% of base) - TestApp:test_68(int):long
          -2 (-12.50% of base) - TestApp:test_263(int):long
          -2 (-12.50% of base) - TestApp:test_107(int):long
          -4 (-11.76% of base) - Internal.NativeFormat.TypeHashingAlgorithms:ComputeByrefTypeHashCode(long):int
          -4 (-11.76% of base) - Internal.NativeFormat.TypeHashingAlgorithms:ComputeArrayTypeHashCode(long,int):int
          -4 (-11.76% of base) - Internal.NativeFormat.TypeHashingAlgorithms:ComputePointerTypeHashCode(long):int
          -4 (-10.53% of base) - TestApp:test_351(long,long):long
          -4 (-10.53% of base) - TestApp:test_78(long,long):long
          -4 (-10.53% of base) - TestApp:test_117(long,long):long
          -4 (-10.53% of base) - TestApp:test_273(long,long):long
          -4 (-10.53% of base) - TestApp:test_312(long,long):long
          -4 (-10.53% of base) - TestApp:test_195(long,long):long
          -2 (-10.00% of base) - JIT.HardwareIntrinsics.Arm.Helpers:FusedAddHalving(int,int):int
          -2 (-10.00% of base) - JIT.HardwareIntrinsics.Arm.Helpers:FusedSubtractHalving(int,int):int
          -2 (-10.00% of base) - JIT.HardwareIntrinsics.Arm.Helpers:FusedAddHalving(int,int):int

8612 total methods with Code Size differences (8612 improved, 0 regressed), 64 unchanged.

Running asm diffs of libraries.crossgen.Linux.arm.checked.mch

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 233970
Total bytes of diff: 231736
Total bytes of delta: -2234 (-0.95% of base)
    diff is an improvement.


Top method regressions (bytes):
           6 (60.00% of base) - Counts:get_SignalCount():int:this
           2 ( 0.79% of base) - System.Buffers.Text.Utf8Formatter:TryFormatUInt64X(long,ubyte,bool,System.Span`1[Byte],byref):bool

Top method improvements (bytes):
         -80 (-4.25% of base) - DecCalc:DecAddSub(byref,byref,bool)
         -42 (-4.69% of base) - <PgoEncodedCompressedLongGenerator>d__5:MoveNext():bool:this
         -34 (-4.84% of base) - BigNumber:Mul(byref):this
         -30 (-2.71% of base) - System.Threading.LowLevelLifoSemaphore:Wait(int,bool):bool:this
         -28 (-1.60% of base) - System.Data.SqlTypes.SqlDecimal:MpDiv(System.ReadOnlySpan`1[UInt32],int,System.Span`1[UInt32],int,System.Span`1[UInt32],byref,System.Span`1[UInt32],byref)
         -28 (-12.28% of base) - Newtonsoft.Json.Bson.AsyncBinaryWriter:WriteAsync(long,System.Threading.CancellationToken):System.Threading.Tasks.Task:this
         -26 (-1.73% of base) - System.Numerics.Matrix4x4:Decompose(System.Numerics.Matrix4x4,byref,byref,byref):bool
         -24 (-2.41% of base) - Microsoft.CodeAnalysis.EnumConstantHelper:OffsetValue(Microsoft.CodeAnalysis.ConstantValue,int,byref):int
         -24 (-2.03% of base) - DecCalc:ScaleResult(int,int,int):int
         -22 (-2.78% of base) - Newtonsoft.Json.Utilities.JavaScriptUtils:TryGetDateFromConstructorJson(Newtonsoft.Json.JsonReader,byref,byref):bool
         -22 (-5.56% of base) - BigInteger:DivRem(BigInteger):int:this
         -20 (-0.72% of base) - System.Uri:CheckAuthorityHelper(int,int,int,byref,byref,System.UriParser,byref):int:this
         -18 (-1.58% of base) - System.Number:TryNumberToDecimal(byref,byref):bool
         -18 (-2.91% of base) - System.Xml.Schema.XsdDuration:.ctor(System.TimeSpan,int):this
         -16 (-0.64% of base) - System.Text.Unicode.Utf8Utility:TranscodeToUtf16(int,int,int,int,byref,byref):int
         -16 (-3.88% of base) - System.Sha1ForNonSecretPurposes:Finish(System.Span`1[Byte]):this
         -16 (-1.82% of base) - System.Globalization.TextInfo:ChangeCaseCommon(byref,byref,int):this
         -14 (-0.51% of base) - DecCalc:VarDecDiv(byref,byref)
         -14 (-2.10% of base) - System.Buffers.Text.Utf8Parser:TryParseGuidN(System.ReadOnlySpan`1[Byte],byref,byref):bool
         -14 (-1.20% of base) - System.Buffers.Text.Utf8Parser:TryParseGuidCore(System.ReadOnlySpan`1[Byte],byref,byref,int):bool

Top method regressions (percentages):
           6 (60.00% of base) - Counts:get_SignalCount():int:this
           2 ( 0.79% of base) - System.Buffers.Text.Utf8Formatter:TryFormatUInt64X(long,ubyte,bool,System.Span`1[Byte],byref):bool

Top method improvements (percentages):
          -4 (-28.57% of base) - UIntPtrIEquality@2047:System.Collections.Generic.IEqualityComparer<System.UIntPtr>.GetHashCode(int):int:this
          -2 (-25.00% of base) - IntPtrIEquality@2042:System.Collections.Generic.IEqualityComparer<System.IntPtr>.GetHashCode(int):int:this
          -2 (-20.00% of base) - System.Xml.Xsl.Location:get_Line():int:this
          -4 (-20.00% of base) - ThreadCounts:get_NumExistingThreads():short:this
          -4 (-18.18% of base) - Int64IEquality@2041:System.Collections.Generic.IEqualityComparer<System.Int64>.GetHashCode(long):int:this
          -2 (-16.67% of base) - System.Decimal:get_Mid():int:this
          -2 (-16.67% of base) - System.Int64:GetHashCode():int:this
          -2 (-16.67% of base) - System.TimeSpan:GetHashCode():int:this
          -2 (-16.67% of base) - System.Xml.Xsl.SourceLineInfo:get_StartLine():int:this
          -2 (-16.67% of base) - ThreadCounts:get_NumThreadsGoal():short:this
          -2 (-16.67% of base) - ThreadCounts:GetHashCode():int:this
          -2 (-16.67% of base) - Counts:GetHashCode():int:this
          -2 (-16.67% of base) - ThreadCounts:get_NumProcessingWork():short:this
          -2 (-16.67% of base) - System.TimeOnly:GetHashCode():int:this
          -2 (-16.67% of base) - System.UInt64:GetHashCode():int:this
          -2 (-16.67% of base) - Counts:get_WaiterCount():ushort:this
          -2 (-14.29% of base) - Counts:get_CountOfWaitersSignaledToWake():ubyte:this
          -2 (-14.29% of base) - Counts:get_SpinnerCount():ubyte:this
          -2 (-12.50% of base) - System.Data.SqlTypes.SqlDecimal:HI(long):int
         -28 (-12.28% of base) - Newtonsoft.Json.Bson.AsyncBinaryWriter:WriteAsync(long,System.Threading.CancellationToken):System.Threading.Tasks.Task:this

522 total methods with Code Size differences (520 improved, 2 regressed), 8 unchanged.

Running asm diffs of libraries.crossgen2.Linux.arm.checked.mch

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 251758
Total bytes of diff: 249450
Total bytes of delta: -2308 (-0.92% of base)
    diff is an improvement.


Top method regressions (bytes):
           6 (60.00% of base) - Counts:get_SignalCount():int:this
           2 ( 0.76% of base) - System.Buffers.Text.Utf8Formatter:TryFormatUInt64X(long,ubyte,bool,System.Span`1[System.Byte],byref):bool

Top method improvements (bytes):
         -80 (-4.22% of base) - DecCalc:DecAddSub(byref,byref,bool)
         -42 (-7.27% of base) - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstCharToEncode(System.ReadOnlySpan`1[System.Char]):int:this
         -42 (-4.69% of base) - <PgoEncodedCompressedLongGenerator>d__5:MoveNext():bool:this
         -42 (-4.69% of base) - <PgoEncodedCompressedLongGenerator>d__5:MoveNext():bool:this
         -34 (-4.84% of base) - BigNumber:Mul(byref):this
         -30 (-2.71% of base) - System.Threading.LowLevelLifoSemaphore:Wait(int,bool):bool:this
         -28 (-11.76% of base) - Newtonsoft.Json.Bson.AsyncBinaryWriter:WriteAsync(long,System.Threading.CancellationToken):System.Threading.Tasks.Task:this
         -28 (-1.58% of base) - System.Data.SqlTypes.SqlDecimal:MpDiv(System.ReadOnlySpan`1[System.UInt32],int,System.Span`1[System.UInt32],int,System.Span`1[System.UInt32],byref,System.Span`1[System.UInt32],byref)
         -26 (-1.73% of base) - System.Numerics.Matrix4x4:Decompose(System.Numerics.Matrix4x4,byref,byref,byref):bool
         -24 (-2.38% of base) - Microsoft.CodeAnalysis.EnumConstantHelper:OffsetValue(Microsoft.CodeAnalysis.ConstantValue,int,byref):int
         -24 (-2.03% of base) - DecCalc:ScaleResult(int,int,int):int
         -22 (-5.42% of base) - BigInteger:DivRem(System.Xml.Xsl.XPathConvert+BigInteger):int:this
         -22 (-2.78% of base) - Newtonsoft.Json.Utilities.JavaScriptUtils:TryGetDateFromConstructorJson(Newtonsoft.Json.JsonReader,byref,byref):bool
         -20 (-0.72% of base) - System.Uri:CheckAuthorityHelper(int,int,int,byref,byref,System.UriParser,byref):int:this
         -18 (-1.52% of base) - System.Number:TryNumberToDecimal(byref,byref):bool
         -18 (-2.91% of base) - System.Xml.Schema.XsdDuration:.ctor(System.TimeSpan,int):this
         -16 (-0.64% of base) - System.Text.Unicode.Utf8Utility:TranscodeToUtf16(int,int,int,int,byref,byref):int
         -16 (-0.64% of base) - System.Resources.Extensions.PreserializedResourceWriter:Generate():this
         -16 (-3.79% of base) - System.Sha1ForNonSecretPurposes:Finish(System.Span`1[System.Byte]):this
         -14 (-0.50% of base) - DecCalc:VarDecDiv(byref,byref)

Top method regressions (percentages):
           6 (60.00% of base) - Counts:get_SignalCount():int:this
           2 ( 0.76% of base) - System.Buffers.Text.Utf8Formatter:TryFormatUInt64X(long,ubyte,bool,System.Span`1[System.Byte],byref):bool

Top method improvements (percentages):
          -4 (-28.57% of base) - UIntPtrIEquality@2047:System.Collections.Generic.IEqualityComparer<System.UIntPtr>.GetHashCode(int):int:this
          -2 (-25.00% of base) - IntPtrIEquality@2042:System.Collections.Generic.IEqualityComparer<System.IntPtr>.GetHashCode(int):int:this
          -4 (-20.00% of base) - ThreadCounts:get_NumExistingThreads():short:this
          -2 (-20.00% of base) - System.Xml.Xsl.Location:get_Line():int:this
          -4 (-18.18% of base) - Int64IEquality@2041:System.Collections.Generic.IEqualityComparer<System.Int64>.GetHashCode(long):int:this
          -2 (-16.67% of base) - System.TimeSpan:GetHashCode():int:this
          -2 (-16.67% of base) - ThreadCounts:get_NumProcessingWork():short:this
          -2 (-16.67% of base) - System.Decimal:get_Mid():int:this
          -2 (-16.67% of base) - System.Xml.Xsl.SourceLineInfo:get_StartLine():int:this
          -2 (-16.67% of base) - ThreadCounts:GetHashCode():int:this
          -2 (-16.67% of base) - ThreadCounts:get_NumThreadsGoal():short:this
          -2 (-16.67% of base) - System.TimeOnly:GetHashCode():int:this
          -2 (-16.67% of base) - Counts:GetHashCode():int:this
          -2 (-16.67% of base) - System.Int64:GetHashCode():int:this
          -2 (-16.67% of base) - Counts:get_WaiterCount():ushort:this
          -2 (-16.67% of base) - System.UInt64:GetHashCode():int:this
          -2 (-14.29% of base) - Counts:get_CountOfWaitersSignaledToWake():ubyte:this
          -2 (-14.29% of base) - Counts:get_SpinnerCount():ubyte:this
          -2 (-12.50% of base) - System.Data.SqlTypes.SqlDecimal:HI(long):int
         -28 (-11.76% of base) - Newtonsoft.Json.Bson.AsyncBinaryWriter:WriteAsync(long,System.Threading.CancellationToken):System.Threading.Tasks.Task:this

527 total methods with Code Size differences (525 improved, 2 regressed), 7 unchanged.

Running asm diffs of libraries.pmi.Linux.arm.checked.mch

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 180778
Total bytes of diff: 179160
Total bytes of delta: -1618 (-0.90% of base)
    diff is an improvement.


Top file improvements (bytes):
         -42 : 181996.dasm (-4.79% of base)
         -38 : 208449.dasm (-7.76% of base)
         -34 : 32705.dasm (-4.84% of base)
         -28 : 196650.dasm (-13.21% of base)
         -26 : 165992.dasm (-0.75% of base)
         -24 : 84904.dasm (-2.95% of base)
         -16 : 42431.dasm (-3.46% of base)
         -16 : 177600.dasm (-0.60% of base)
         -16 : 32258.dasm (-3.09% of base)
         -16 : 6.dasm (-3.46% of base)
         -14 : 48128.dasm (-0.82% of base)
         -14 : 201680.dasm (-0.59% of base)
         -14 : 177581.dasm (-1.48% of base)
         -14 : 177638.dasm (-1.40% of base)
         -14 : 208874.dasm (-0.59% of base)
         -12 : 129.dasm (-4.00% of base)
         -12 : 32730.dasm (-3.17% of base)
         -12 : 24935.dasm (-2.26% of base)
         -12 : 81217.dasm (-1.11% of base)
         -12 : 119921.dasm (-6.59% of base)

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

Top method improvements (bytes):
         -42 (-4.79% of base) - <PgoEncodedCompressedLongGenerator>d__5:MoveNext():bool:this
         -38 (-7.76% of base) - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstCharToEncode(System.ReadOnlySpan`1[Char]):int:this
         -34 (-4.84% of base) - BigNumber:Mul(byref):this
         -28 (-13.21% of base) - Newtonsoft.Json.Bson.AsyncBinaryWriter:WriteAsync(long,System.Threading.CancellationToken):System.Threading.Tasks.Task:this
         -26 (-0.75% of base) - System.Drawing.ColorConverter:ConvertTo(System.ComponentModel.ITypeDescriptorContext,System.Globalization.CultureInfo,System.Object,System.Type):System.Object:this
         -24 (-2.95% of base) - Microsoft.CodeAnalysis.EnumConstantHelper:OffsetValue(Microsoft.CodeAnalysis.ConstantValue,int,byref):int
         -16 (-3.46% of base) - System.Text.Latin1Utility:NarrowUtf16ToLatin1(int,int,int):int
         -16 (-0.60% of base) - System.Uri:CheckAuthorityHelper(int,int,int,byref,byref,System.UriParser,byref):int:this
         -16 (-3.09% of base) - System.Xml.Schema.XsdDuration:.ctor(System.TimeSpan,int):this
         -16 (-3.46% of base) - System.Text.ASCIIUtility:NarrowUtf16ToAscii(int,int,int):int
         -14 (-0.82% of base) - System.Data.SqlTypes.SqlDecimal:MpDiv(System.ReadOnlySpan`1[UInt32],int,System.Span`1[UInt32],int,System.Span`1[UInt32],byref,System.Span`1[UInt32],byref)
         -14 (-0.59% of base) - System.Resources.ResourceWriter:Generate():this
         -14 (-1.48% of base) - System.Uri:InternalIsWellFormedOriginalString():bool:this
         -14 (-1.40% of base) - System.Uri:CreateUriInfo(long):this
         -14 (-0.59% of base) - System.Resources.Extensions.PreserializedResourceWriter:Generate():this
         -12 (-4.00% of base) - System.Text.ASCIIUtility:WidenAsciiToUtf16(int,int,int):int
         -12 (-3.17% of base) - BigInteger:DivRem(BigInteger):int:this
         -12 (-2.26% of base) - System.Xml.BinXmlDateTime:BreakDownXsdDateTime(long,byref,byref,byref,byref,byref,byref,byref)
         -12 (-1.11% of base) - System.Drawing.Icon:SaveBitmapAsIcon(System.IO.BinaryWriter):this
         -12 (-6.59% of base) - System.Net.Http.Headers.RangeItemHeaderValue:GetHashCode():int:this

Top method improvements (percentages):
          -2 (-20.00% of base) - System.Xml.Xsl.Location:get_Line():int:this
          -4 (-18.18% of base) - System.Collections.Generic.ObjectEqualityComparer`1[Int64][System.Int64]:GetHashCode(long):int:this
          -2 (-16.67% of base) - Internal.Microsoft.DotNet.PlatformAbstractions.HashCodeCombiner:get_CombinedHash():int:this
          -2 (-16.67% of base) - IdOfIncompleteAction:GetHashCode():int:this
          -2 (-16.67% of base) - Microsoft.DotNet.PlatformAbstractions.HashCodeCombiner:get_CombinedHash():int:this
          -2 (-16.67% of base) - System.Xml.Xsl.SourceLineInfo:get_StartLine():int:this
          -2 (-14.29% of base) - Microsoft.CodeAnalysis.SyntaxAnnotation:GetHashCode():int:this
         -28 (-13.21% of base) - Newtonsoft.Json.Bson.AsyncBinaryWriter:WriteAsync(long,System.Threading.CancellationToken):System.Threading.Tasks.Task:this
          -4 (-12.50% of base) - System.HashCode:Add(long):this
          -2 (-12.50% of base) - System.Data.SqlTypes.SqlDecimal:HI(long):int
          -2 (-12.50% of base) - System.Xml.Xsl.XPathConvert:DblHi(double):int
         -10 (-11.90% of base) - Microsoft.CodeAnalysis.AssemblyIdentity:ToVersion(long):System.Version
          -4 (-11.76% of base) - Internal.NativeFormat.TypeHashingAlgorithms:ComputePointerTypeHashCode(long):int
          -4 (-11.76% of base) - Internal.NativeFormat.TypeHashingAlgorithms:ComputeArrayTypeHashCode(long,int):int
          -4 (-11.76% of base) - InternTable`1[Int64][System.Int64]:BucketNumberFromValue(long,int):int
          -4 (-11.76% of base) - Internal.NativeFormat.TypeHashingAlgorithms:ComputeByrefTypeHashCode(long):int
          -4 (-10.00% of base) - System.Text.Latin1Utility:WidenLatin1ToUtf16_Fallback(int,int,int)
          -4 (-10.00% of base) - AsciiPreescapedData:TryGetPreescapedData(int,byref):bool:this
          -2 (-10.00% of base) - System.Reflection.Metadata.Ecma335.TokenTypeIds:IsValidRowId(int):bool
          -2 (-10.00% of base) - NonStructural@26[Int64][System.Int64]:System.Collections.Generic.IEqualityComparer<'T>.GetHashCode(long):int:this

408 total methods with Code Size differences (408 improved, 0 regressed), 4 unchanged.

Running asm diffs of libraries_tests.pmi.Linux.arm.checked.mch

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 363852
Total bytes of diff: 360716
Total bytes of delta: -3136 (-0.86% of base)
    diff is an improvement.


Top file improvements (bytes):
        -104 : 266082.dasm (-1.42% of base)
        -102 : 267383.dasm (-1.36% of base)
         -64 : 266154.dasm (-3.44% of base)
         -64 : 266149.dasm (-3.44% of base)
         -64 : 266191.dasm (-2.42% of base)
         -56 : 108145.dasm (-14.74% of base)
         -56 : 129457.dasm (-14.74% of base)
         -54 : 266053.dasm (-1.03% of base)
         -42 : 267388.dasm (-0.92% of base)
         -32 : 183428.dasm (-1.35% of base)
         -28 : 288870.dasm (-2.10% of base)
         -26 : 114692.dasm (-0.51% of base)
         -24 : 267881.dasm (-1.42% of base)
         -18 : 114697.dasm (-0.33% of base)
         -18 : 30899.dasm (-1.45% of base)
         -16 : 6.dasm (-3.46% of base)
         -16 : 112670.dasm (-1.24% of base)
         -16 : 114709.dasm (-1.81% of base)
         -14 : 8959.dasm (-6.25% of base)
         -12 : 114704.dasm (-1.50% of base)

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

Top method improvements (bytes):
        -104 (-1.42% of base) - MonoTests.System.Drawing.TestBitmap:FormatTest(int):this
        -102 (-1.36% of base) - System.Drawing.Tests.BitmapTests:CustomPixelFormat_GetPixels_ReturnsExpected(int):this
         -64 (-3.44% of base) - MonoTests.System.Drawing.Imaging.IconCodecTest:Bitmap32Features_PaletteEntries_Unix():this
         -64 (-3.44% of base) - MonoTests.System.Drawing.Imaging.IconCodecTest:Bitmap16Features_Palette_Entries_Unix():this
         -64 (-2.42% of base) - MonoTests.System.Drawing.Imaging.PngCodecTest:Bitmap4bitFeatures():this
         -56 (-14.74% of base) - System.Data.SqlClient.TdsParser:WriteLong(long,System.Data.SqlClient.TdsParserStateObject):this
         -56 (-14.74% of base) - System.Data.SqlClient.TdsParser:WriteLong(long,System.Data.SqlClient.TdsParserStateObject):this
         -54 (-1.03% of base) - MonoTests.System.Drawing.TestBitmap:LockUnlockBitmap():this
         -42 (-0.92% of base) - System.Drawing.Tests.BitmapTests:LockBits_Marshalling_Success():this
         -32 (-1.35% of base) - System.Threading.Tasks.Tests.CancellationTokenTests:CancellationTokenRegistration_EqualityAndHashCode()
         -28 (-2.10% of base) - System.Drawing.Primitives.Tests.ColorTests:FromArgb_Roundtrips(int,int,int,int):this
         -26 (-0.51% of base) - System.Buffers.Binary.Tests.BinaryReaderUnitTests:ReadOnlySpanRead():this
         -24 (-1.42% of base) - System.Drawing.Tests.IconTests:SaveAndCompare(System.Drawing.Icon,bool)
         -18 (-0.33% of base) - System.Buffers.Binary.Tests.BinaryReaderUnitTests:ReadingStructFieldByFieldOrReadAndReverseEndianness():this
         -18 (-1.45% of base) - System.Tests.TimeOnlyTests:AllCulturesTest()
         -16 (-3.46% of base) - System.Text.ASCIIUtility:NarrowUtf16ToAscii(int,int,int):int
         -16 (-1.24% of base) - System.TestHelpers:GetSpanBE():System.Span`1[Byte]
         -16 (-1.81% of base) - System.Buffers.Binary.Tests.BinaryWriterUnitTests:SpanWriteDouble(double):this
         -14 (-6.25% of base) - System.Net.Test.Common.QPackTestDecoder:DecodeInteger(System.ReadOnlySpan`1[Byte],ubyte):System.ValueTuple`2[Int32,Int32]
         -12 (-1.50% of base) - System.Buffers.Binary.Tests.BinaryWriterUnitTests:SpanWriteInt64(long):this

Top method improvements (percentages):
          -4 (-18.18% of base) - ReferenceEqualityComparer`1[Int64][System.Int64]:GetHashCode(long):int:this
          -2 (-16.67% of base) - Microsoft.Diagnostics.Runtime.ClrObject:GetHashCode():int:this
          -2 (-16.67% of base) - Humanizer.Bytes.ByteSize:GetHashCode():int:this
          -2 (-16.67% of base) - Microsoft.DotNet.InternalAbstractions.HashCodeCombiner:get_CombinedHash():int:this
         -56 (-14.74% of base) - System.Data.SqlClient.TdsParser:WriteLong(long,System.Data.SqlClient.TdsParserStateObject):this
         -56 (-14.74% of base) - System.Data.SqlClient.TdsParser:WriteLong(long,System.Data.SqlClient.TdsParserStateObject):this
          -2 (-14.29% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -2 (-14.29% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -2 (-14.29% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -2 (-14.29% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -2 (-14.29% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -2 (-14.29% of base) - System.Collections.ObjectModel.Tests.KeyedItem`2[__Canon,Int64][System.__Canon,System.Int64]:GetHashCode():int:this
          -2 (-14.29% of base) - System.Collections.ObjectModel.Tests.KeyedItem`2[Byte,Int64][System.Byte,System.Int64]:GetHashCode():int:this
          -2 (-14.29% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -2 (-14.29% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -2 (-14.29% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -2 (-14.29% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -2 (-14.29% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -2 (-14.29% of base) - NuGet.Shared.HashCodeCombiner:get_CombinedHash():int:this
          -4 (-13.33% of base) - System.Linq.Parallel.Tests.CancelingEqualityComparer`1[Int64][System.Int64]:GetHashCode(long):int:this

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

I spot-checked the regressions and they seem to be due to slightly different register allocation (and one due to a loop now being aligned).

There is one regression on ARM (in Counts:get_SignalCount) that is caused by the fact that unused indirections appear to generate more code that those used by a GT_LONG (LIR diff, codegen dump diff).

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 20, 2021
@SingleAccretion SingleAccretion force-pushed the De-Decompose-Casts branch 7 times, most recently from 7188bef to 9048f58 Compare May 22, 2021 23:17
@SingleAccretion SingleAccretion marked this pull request as ready for review June 2, 2021 23:29
It is easy to get it wrong. Let the frontend handle this.
@SingleAccretion
Copy link
Contributor Author

SingleAccretion commented Jun 16, 2021

Note to myself: the code assumes (indeed, asserts) that there are no nodes between the cast and the source. That is an incorrect assumption and must be fixed.

Edit: fixed.

Previous version of the code assumed that there could be
no nodes between the cast and its operand. That is not
a correct assumption to make in LIR.
@tannergooding
Copy link
Member

CC. @dotnet/jit-contrib, community PR

Copy link
Contributor

@sandreenko sandreenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, the diffs are quite impressive, nice catch for 32-bit platforms!

@sandreenko sandreenko merged commit b5b8863 into dotnet:main Jun 25, 2021
@SingleAccretion SingleAccretion deleted the De-Decompose-Casts branch June 25, 2021 09:33
@ghost ghost locked as resolved and limited conversation to collaborators Jul 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants