Commit 84571ac2 by Antonio Maiorano

Subzero: fix alloca return address allocation

Only breaks in Om1 optimization mode because this code path is specific to Om1. Broke after 01386d17 was merged because maxOutArgsSizeBytes() now returns 32 bytes for the shadow store, so this is a rarely exercised code path. Problem is that on x64, the new register being created needs to match the size of the destination register, so 64 bits, not 32 as it was assuming. Fixes ReactorUnitTests Call_ArgsMixed, Call_ArgsPointer, IntrinsicTest_* which were asstering with: Assertion failed: !isScalarIntegerType(Dest->getType()) || (typeWidthInBytes(Dest->getType()) <= typeWidthInBytes(Source->getType())), file C:\src\SwiftShader2\third_party\subzero\src\IceInstX86Base.h, line 1308 Bug: b/145685985 Change-Id: I298edd5b4a286a242b351cc6267d70ecb37943fb Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/39169 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarAntonio Maiorano <amaiorano@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 86dc7319
......@@ -1570,7 +1570,7 @@ void TargetX86Base<TraitsType>::lowerAlloca(const InstAlloca *Instr) {
// Add enough to the returned address to account for the out args area.
uint32_t OutArgsSize = maxOutArgsSizeBytes();
if (OutArgsSize > 0) {
Variable *T = makeReg(IceType_i32);
Variable *T = makeReg(Dest->getType());
auto *CalculateOperand = X86OperandMem::create(
Func, IceType_void, esp, Ctx->getConstantInt(IceType_i32, OutArgsSize));
_lea(T, CalculateOperand);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment