Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

JIT: simple redundant compare optimization#43811

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
AndyAyersMS merged 2 commits intodotnet:masterfromAndyAyersMS:RedundantBranches
Nov 4, 2020

Conversation

@AndyAyersMS
Copy link
Member

For a relop, walk up the dominator tree to see if any dominating
block has a similar compare. If so, and there's just one path from
that block to the relop, the relop's value is known.

Closes#11909.

am11 reacted with thumbs up emoji
For a relop, walk up the dominator tree to see if any dominatingblock has a similar compare. If so, and there's just one path fromthat block to the relop, the relop's value is known.Closesdotnet#11909.
@Dotnet-GitSync-BotDotnet-GitSync-Bot added the area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labelOct 25, 2020
@AndyAyersMS
Copy link
MemberAuthor

@briansull PTAL.
cc @dotnet/jit-contrib

This will eventually feed into optimizing redundant class checks we'll see in dynamic PGO.

PMI CodeSize Diffs for System.Private.CoreLib.dll, framework assemblies for x64 default jitSummary of Code Size diffs:(Lower is better)Total bytes of base: 50312241Total bytes of diff: 50302279Total bytes of delta: -9962 (-0.02% of base)    diff is an improvement.Top file improvements (bytes):       -4129 : System.Data.Common.dasm (-0.28% of base)       -3542 : FSharp.Core.dasm (-0.11% of base)        -637 : System.Private.CoreLib.dasm (-0.01% of base)        -274 : Microsoft.CodeAnalysis.CSharp.dasm (-0.01% of base)        -258 : Microsoft.CodeAnalysis.VisualBasic.dasm (-0.00% of base)        -154 : System.Text.Json.dasm (-0.03% of base)        -104 : System.Security.Cryptography.Pkcs.dasm (-0.03% of base)         -89 : Microsoft.Extensions.DependencyModel.dasm (-0.19% of base)         -75 : System.Formats.Asn1.dasm (-0.08% of base)         -63 : System.Net.Http.dasm (-0.01% of base)         -61 : System.DirectoryServices.AccountManagement.dasm (-0.02% of base)         -59 : System.Linq.Expressions.dasm (-0.01% of base)         -38 : Microsoft.Extensions.Logging.Console.dasm (-0.09% of base)         -36 : System.Diagnostics.Process.dasm (-0.04% of base)         -35 : Microsoft.Diagnostics.Tracing.TraceEvent.dasm (-0.00% of base)         -33 : System.Private.Xml.dasm (-0.00% of base)         -30 : System.Memory.dasm (-0.01% of base)         -28 : System.Text.Encodings.Web.dasm (-0.09% of base)         -27 : System.Security.Cryptography.Algorithms.dasm (-0.01% of base)         -27 : System.Security.Cryptography.Cng.dasm (-0.02% of base)42 total files with Code Size differences (42 improved, 0 regressed), 226 unchanged.Top method improvements (bytes):        -529 (-14.86% of base) : System.Data.Common.dasm - SqlDoubleStorage:Aggregate(ref,int):Object:this        -449 (-12.49% of base) : System.Data.Common.dasm - SqlSingleStorage:Aggregate(ref,int):Object:this        -446 (-13.78% of base) : System.Data.Common.dasm - SqlInt16Storage:Aggregate(ref,int):Object:this        -446 (-13.79% of base) : System.Data.Common.dasm - SqlInt32Storage:Aggregate(ref,int):Object:this        -446 (-12.31% of base) : System.Data.Common.dasm - SqlInt64Storage:Aggregate(ref,int):Object:this        -446 (-11.65% of base) : System.Data.Common.dasm - SqlMoneyStorage:Aggregate(ref,int):Object:this        -446 (-13.72% of base) : System.Data.Common.dasm - SqlByteStorage:Aggregate(ref,int):Object:this        -440 (-11.14% of base) : System.Data.Common.dasm - SqlDecimalStorage:Aggregate(ref,int):Object:this        -203 (-5.40% of base) : System.Private.CoreLib.dasm - TextInfo:ChangeCaseCommon(String):String:this (7 methods)        -151 (-44.41% of base) : System.Data.Common.dasm - DataTable:FindByIndex(Index,ref):DataRow:this        -139 (-20.20% of base) : System.Data.Common.dasm - DataView:System.ComponentModel.IBindingList.Find(PropertyDescriptor,Object):int:this        -134 (-9.48% of base) : System.Data.Common.dasm - DataTable:LoadRow(ref,int,Index):DataRow:this        -130 (-20.57% of base) : FSharp.Core.dasm - NullableOperators:op_QmarkEqualsQmark(Nullable`1,Nullable`1):bool (6 methods)        -127 (-12.99% of base) : System.Private.CoreLib.dasm - Vector128`1:<Equals>g__SoftwareFallback|12_0(byref,Vector128`1):bool (6 methods)         -95 (-21.16% of base) : FSharp.Core.dasm - NullableOperators:op_QmarkGreaterEqualsQmark(Nullable`1,Nullable`1):bool (6 methods)         -95 (-21.16% of base) : FSharp.Core.dasm - NullableOperators:op_QmarkGreaterQmark(Nullable`1,Nullable`1):bool (6 methods)         -95 (-21.16% of base) : FSharp.Core.dasm - NullableOperators:op_QmarkLessEqualsQmark(Nullable`1,Nullable`1):bool (6 methods)         -95 (-21.16% of base) : FSharp.Core.dasm - NullableOperators:op_QmarkLessQmark(Nullable`1,Nullable`1):bool (6 methods)         -87 (-10.48% of base) : System.Private.CoreLib.dasm - Vector256`1:<Equals>g__SoftwareFallback|14_0(byref,Vector256`1):bool (6 methods)         -82 (-3.63% of base) : Microsoft.CodeAnalysis.VisualBasic.dasm - CodeGenerator:EmitTryCastExpression(BoundTryCast,bool):thisTop method improvements (percentages):         -22 (-50.00% of base) : FSharp.Core.dasm - NullableOperators:op_QmarkGreaterEquals(Nullable`1,long):bool         -22 (-50.00% of base) : FSharp.Core.dasm - NullableOperators:op_QmarkGreater(Nullable`1,long):bool         -22 (-50.00% of base) : FSharp.Core.dasm - NullableOperators:op_QmarkLessEquals(Nullable`1,long):bool         -22 (-50.00% of base) : FSharp.Core.dasm - NullableOperators:op_QmarkLess(Nullable`1,long):bool         -22 (-50.00% of base) : FSharp.Core.dasm - NullableOperators:op_QmarkEquals(Nullable`1,long):bool         -22 (-50.00% of base) : FSharp.Core.dasm - NullableOperators:op_GreaterEqualsQmark(long,Nullable`1):bool         -22 (-50.00% of base) : FSharp.Core.dasm - NullableOperators:op_GreaterQmark(long,Nullable`1):bool         -22 (-50.00% of base) : FSharp.Core.dasm - NullableOperators:op_LessEqualsQmark(long,Nullable`1):bool         -22 (-50.00% of base) : FSharp.Core.dasm - NullableOperators:op_LessQmark(long,Nullable`1):bool         -22 (-50.00% of base) : FSharp.Core.dasm - NullableOperators:op_EqualsQmark(long,Nullable`1):bool         -22 (-45.83% of base) : FSharp.Core.dasm - NullableOperators:op_QmarkGreaterEquals(Nullable`1,double):bool         -22 (-45.83% of base) : FSharp.Core.dasm - NullableOperators:op_QmarkGreater(Nullable`1,double):bool         -22 (-45.83% of base) : FSharp.Core.dasm - NullableOperators:op_QmarkLessEquals(Nullable`1,double):bool         -22 (-45.83% of base) : FSharp.Core.dasm - NullableOperators:op_QmarkLess(Nullable`1,double):bool         -22 (-45.83% of base) : FSharp.Core.dasm - NullableOperators:op_QmarkEquals(Nullable`1,int):bool         -22 (-45.83% of base) : FSharp.Core.dasm - NullableOperators:op_QmarkEquals(Nullable`1,double):bool         -22 (-45.83% of base) : FSharp.Core.dasm - NullableOperators:op_GreaterEqualsQmark(double,Nullable`1):bool         -22 (-45.83% of base) : FSharp.Core.dasm - NullableOperators:op_GreaterQmark(double,Nullable`1):bool         -22 (-45.83% of base) : FSharp.Core.dasm - NullableOperators:op_LessEqualsQmark(double,Nullable`1):bool         -22 (-45.83% of base) : FSharp.Core.dasm - NullableOperators:op_LessQmark(double,Nullable`1):bool257 total methods with Code Size differences (257 improved, 0 regressed), 258511 unchanged.

Diff from#11909

; Assembly listing for method String:EndsWith(String,int):bool:this;; BEFOREG_M26632_IG11:movebx, dword ptr[rdi+8]movr8d,ebxsubr8d,r9dcmpebx,r8djb       SHORT G_M26632_IG16cmpebx,r8djb       G_M26632_IG22G_M26632_IG12:addrdi,12;; AFTERG_M26632_IG11:movebx, dword ptr[rdi+8]movr8d,ebxsubr8d,r9dcmpebx,r8djb       SHORT G_M26632_IG15addrdi,12

@AndyAyersMS
Copy link
MemberAuthor

Note it feels a bit odd to be doing this opt here, as it's not strictly related to assertion prop, but it doesn't seem to warrant its own phase. Feel free to suggest a better home.

@AndyAyersMS
Copy link
MemberAuthor

@dotnet/jit-contrib anyone able to take a look?

Copy link
Contributor

@briansullbriansull left a comment

Choose a reason for hiding this comment

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

Approved with doc suggestion

GenTree* op1 = tree->AsOp()->gtOp1;
GenTree* op2 = tree->AsOp()->gtOp2;

// First, walk up the dom tree and see if any dominating block has branched on
Copy link
Contributor

Choose a reason for hiding this comment

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

You should update the method header to the standard header and underNote: add comment saying that we also do this special case optimization.

@AndyAyersMS
Copy link
MemberAuthor

One test failure on x64 osx: profiler/elt/slowpatheltleave/slowpatheltleave.sh

This test seems to fail sporadically once a day or so. It looks like the test "passes" but then perhaps the runtime crashes on exit?

@davmason is this on your radar?

@davmason
Copy link
Contributor

@davmason is this on your radar?

No, I haven't seen that before. I'll take a look

@AndyAyersMS
Copy link
MemberAuthor

I'm going to merge as the one failure above does not seem related.

@benaadams
Copy link
Member

@AndyAyersMS should have also fixed#35348

@ghostghost locked asresolvedand limited conversation to collaboratorsDec 14, 2020
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

1 more reviewer

@briansullbriansullbriansull approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

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

Projects

Archived in project

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Jit doesn't always eliminate identical checks

5 participants

@AndyAyersMS@davmason@benaadams@briansull@Dotnet-GitSync-Bot

[8]ページ先頭

©2009-2025 Movatter.jp