Remove popped trees more aggressively.#31677
Merged
erozenfeld merged 1 commit intodotnet:masterfrom Feb 3, 2020
Merged
Conversation
When processing CEE_POP the importer sometimes created trees like ASG(tmp1, expr) followed by COMMA(ADDR(tmp1), NOP)) and that was causing some CQ issues. LocalAddressVisitor was then marking tmp1 as address-exposed and we never get rid of the dead ASG(tmp1, expr). What's worse, we then were adding a zero-initialization for tmp1 in the prolog. The fix here is to create a NOP instead of a COMMA is there are no side-effects in the first operand of the COMMA. This addresses the first example in dotnet#2325.
Member
Author
|
x64 framework PMI diffs: |
Member
Author
|
Typical diff ( G_M54680_IG01:
push rbp
push r15
push r14
push rdi
push rsi
push rbx
sub rsp, 72
lea rbp, [rsp+70H]
- xor rax, rax
- mov qword ptr [rbp-38H], rax
mov qword ptr [rbp-40H], rsp
mov rsi, rcx
mov rdi, rdx
mov ebx, r8d
mov r14d, r9d
- ;; bbWeight=1 PerfScore 10.00
+ ;; bbWeight=1 PerfScore 8.75
G_M54680_IG02:
xor eax, eax
mov dword ptr [rbp-2CH], eax
;; bbWeight=1 PerfScore 1.25
G_M54680_IG03:
call ExecutionContext:IsFlowSuppressed():bool
test eax, eax
jne SHORT G_M54680_IG05
;; bbWeight=1 PerfScore 2.25
G_M54680_IG04:
call ExecutionContext:SuppressFlow():AsyncFlowControl
- mov gword ptr [rbp-38H], rax
mov dword ptr [rbp-2CH], 1
- ;; bbWeight=0.50 PerfScore 1.50
+ ;; bbWeight=0.50 PerfScore 1.00
G_M54680_IG05:
mov rcx, 0xD1FFAB1E
call CORINFO_HELP_NEWSFAST
mov r15, rax
mov dword ptr [rsp+20H], r14d
mov dword ptr [rsp+28H], 1
mov rcx, r15
mov rdx, rsi
mov r8, rdi
mov r9d, ebx
call Timer:.ctor(TimerCallback,Object,int,int,bool):this
nop
;; bbWeight=1 PerfScore 5.75
G_M54680_IG06:
cmp dword ptr [rbp-2CH], 0
je SHORT G_M54680_IG08
;; bbWeight=1 PerfScore 2.00
G_M54680_IG07:
call ExecutionContext:RestoreFlow()
;; bbWeight=0.50 PerfScore 0.50
G_M54680_IG08:
mov rax, r15
;; bbWeight=1 PerfScore 0.25
G_M54680_IG09:
lea rsp, [rbp-28H]
pop rbx
pop rsi
pop rdi
pop r14
pop r15
pop rbp
ret
;; bbWeight=1 PerfScore 4.50
G_M54680_IG10:
push rbp
push r15
push r14
push rdi
push rsi
push rbx
sub rsp, 56
mov rbp, qword ptr [rcx+48]
mov qword ptr [rsp+30H], rbp
lea rbp, [rbp+70H]
;; bbWeight=0 PerfScore 0.00
G_M54680_IG11:
cmp dword ptr [rbp-2CH], 0
je SHORT G_M54680_IG12
call ExecutionContext:RestoreFlow()
;; bbWeight=0 PerfScore 0.00
G_M54680_IG12:
nop
;; bbWeight=0 PerfScore 0.00
G_M54680_IG13:
add rsp, 56
pop rbx
pop rsi
pop rdi
pop r14
pop r15
pop rbp
ret
;; bbWeight=0 PerfScore 0.00
; Total bytes of code 195, prolog size 39, PerfScore 47.50, (MethodHash=7b152a68) for method ADP:UnsafeCreateTimer(TimerCallback,Object,int,int):Timer
; Total bytes of code 185, prolog size 33, PerfScore 44.75, (MethodHash=7b152a68) for method ADP:UnsafeCreateTimer(TimerCallback,Object,int,int):Timer
|
Member
Author
|
@dotnet/jit-contrib @AndyAyersMS PTAL |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When processing CEE_POP the importer sometimes created trees
like
ASG(tmp1, expr)
followed by
COMMA(ADDR(tmp1), NOP))
and that was causing some CQ issues.
LocalAddressVisitor was then marking tmp1 as address-exposed,
morph adds a GTF_GLOB_REF flag for all address-exposed locals,
and we never get rid of the dead ASG(tmp1, expr). What's worse, we
then were adding a zero-initialization for tmp1 in the prolog.
The fix here is to create a NOP instead of a COMMA if there are
no side effects in the first operand of the COMMA.
This addresses the first example in #2325.