Subzero: fix CoroutineBegin generation
Rework how instructions are injected at the top of the CoroutineBegin
function by getting rid of replaceEntryNode, which attempted to replace
the entry node with a non-entry one. This seemed to work on all targets,
except for Windows x86-32 (Win32) when passing enough arguments to
Coroutines. In this case, it would crash in the code generated right
after this injected code. It looks like the code in replaceEntryNode is
not quite right, resulting in Subzero creating needless stack allocs per
argument, and ultimately generating invalid offsets from the stack
pointer.
Instead of fixing replaceEntryNode, I now simply remember the entryNode
for CoroutineBegin to use, adding the rest to a separate node for
basicBlock, and when finalizing the function, I connect entryNode to the
initial basicBlock node via a branch. This way, there is not messing
around with function's node list.
This not only fixes the crash, but gets rid of the needless stack
allocs per arg.
Bug: angleproject:4482
Change-Id: I13f9c8c43ee07f35302208d9876e6fbdf0b1ad26
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42608
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by:
Antonio Maiorano <amaiorano@google.com>
Reviewed-by:
Nicolas Capens <nicolascapens@google.com>
Showing
Please
register
or
sign in
to comment