Subzero: fix invalid arg access on Windows x86
In addProlog, most arguments are immediately assigned to a register, for
which we emit the proper frame pointer-based move instruction. However,
for arguments that are not immediately assigned to a register, which
happens when many arguments are passed in (e.g. 10), move lowering
happens later during emitIAS, at which point, we call
getFrameOrStackReg to get the base register. The problem is that
this function will always return the stack register on Windows x86,
because needsStackPointerAlignment() is true for this target. As such,
argument access uses the stack pointer, rather than the frame pointer,
which mismatches the offsets computed for these variables in addProlog.
To fix this, stackVarToAsmOperand makes sure to use the frame pointer
for variables that are arguments (not locals) when
needsStackPointerAlignment() is true.
Bug: b/142132927
Change-Id: Ia86680381e48b61e89310f1911e72517bd14b98f
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/37273Reviewed-by:
Ben Clayton <bclayton@google.com>
Reviewed-by:
Alexis Hétu <sugoi@google.com>
Tested-by:
Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Showing
Please
register
or
sign in
to comment