-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
JIT: generalize the branch around empty flow optimization #51409
Conversation
If a BBJ_COND block falls through to an empty block which then jumps to some other block, see if reversing the branch condition might simplify flow. Resolves dotnet#46592.
cc @dotnet/jit-contrib See #46592 for more background, in particular #46592 (comment) Fair number of diffs, mostly positive, sometimes fairly dramatic. The largest improvements come from methods that switch over strings, like asm.benchmarks.run.windows.x64.checked
Detail diffs
asm.libraries.crossgen.windows.x64.checked
Detail diffs
asm.libraries.crossgen2.windows.x64.checked
Detail diffs
asm.libraries.pmi.windows.x64.checked
Detail diffs
asm.tests.pmi.windows.x64.checked
Detail diffs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks Good.
But I note that "diff is a regression" for asm.tests.pmi.windows.x64.checked.
Probably worth investigating the largest regressions
The total regression across the 200K methods is 269 bytes. Looked a few of the worst cases and don't see anything that can easily be addressed. One somewhat related thing I spotted in (or perhaps the issue is that we don't recognize the full extent of the BB02 loop because it has multiple back edges...)
The upshot of this is that we create an "island" block that is only ever jumped to and from ( G_M28147_IG08: ; , epilog, nogc, extend
add rsp, 32
pop rbx
pop rbp
pop rsi
pop rdi
pop r14
ret
;; bbWeight=0.50 PerfScore 1.88
G_M28147_IG09: ; gcVars=0000000000000000 {}, gcrefRegs=00000088 {rbx rdi}, byrefRegs=00000040 {rsi}, gcvars, byref
; gcrRegs +[rbx rdi]
xor eax, eax
mov dword ptr [rsi], eax
jmp G_M28147_IG02
;; bbWeight=4 PerfScore 13.00
G_M28147_IG10: ; gcrefRegs=00000000 {}, byrefRegs=00000000 {}, byref
; gcrRegs -[rbx rdi]
; byrRegs -[rsi]
mov eax, -1
;; bbWeight=0.50 PerfScore 0.12
G_M28147_IG11: ; , epilog, nogc, extend
add rsp, 32
pop rbx
pop rbp
pop rsi
pop rdi
pop r14
ret |
Installer failures look like instances of #51372. Not sure about the innerloop failures ... I suppose I'll retry the failed part.
|
Hmm, failure recurred. Can repro locally; bin log shows C:\repos\runtime0\src\coreclr\jit\fgflow.cpp:355 Now to try and debug... |
If a BBJ_COND block falls through to an empty block which then jumps to some other
block, see if reversing the branch condition might simplify flow.
Resolves #46592.