Eliminate stores succeeded by another store
When a store is propagated to all stores succeeding it in the same basic
block, and we encounter another store, we can delete the previous one.
This optimizes the StoresInMultipleBlocks test's generated code from:
sub rsp,38h
mov dword ptr [rsp],0Dh
cmp ecx,0
je a
mov dword ptr [rsp],4
mov eax,4
add eax,3
mov dword ptr [rsp],eax
b:
mov eax,dword ptr [rsp]
add rsp,38h
ret
a:
mov dword ptr [rsp],6
mov eax,6
add eax,5
mov dword ptr [rsp],eax
jmp b
Into:
sub rsp,38h
mov dword ptr [rsp],0Dh
cmp ecx,0
je a
mov eax,4
add eax,3
mov dword ptr [rsp],eax
jmp b
a:
mov eax,6
add eax,5
mov dword ptr [rsp],eax
b:
mov eax,dword ptr [rsp]
add rsp,38h
ret
Bug: b/179668593
Change-Id: I2036d7b7c97be17ce73ff32234fe51841409a20c
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/52568
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by:
Antonio Maiorano <amaiorano@google.com>
Tested-by:
Nicolas Capens <nicolascapens@google.com>
Showing
Please
register
or
sign in
to comment