Implement scalar replacement of aggregates
This change implements the Scalar Replacement of Aggregates (SRoA)
optimization. Since Reactor only supports array aggregates, this
replaces arrays which are only indexed by static indices with individual
variables for each element.
The ReactorArray test is optimized from:
sub rsp,38h
mov dword ptr [rsp],1
mov dword ptr [rsp+4],2
mov eax,dword ptr [rsp]
mov ecx,dword ptr [rsp+4]
mov dword ptr [rsp],ecx
mov dword ptr [rsp+4],eax
mov eax,dword ptr [rsp+4]
add eax,dword ptr [rsp]
add rsp,38h
ret
Into:
sub rsp,20h
mov eax,2
add eax,1
add rsp,20h
ret
Which is identical to the CArray test's generated code.
Bug: b/179279298
Change-Id: Ie45261f2ac783bdc22fee06adf03ebd588f3ebc3
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/52428
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by:
Nicolas Capens <nicolascapens@google.com>
Reviewed-by:
Antonio Maiorano <amaiorano@google.com>
Showing
Please
register
or
sign in
to comment