x86_64: hack around more OPV bugs

I would just fix this in Sema if it were easy to do so, but this is more
like a (minor) AIR data design issue than a straightforward Sema bug.
This commit is contained in:
Matthew Lugg 2025-12-20 19:01:43 +00:00
parent b27bdd5af0
commit 3f08073f7d
No known key found for this signature in database
GPG key ID: 3F5B7DCCBF4AF02E

View file

@ -171444,12 +171444,14 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
const elem_dies = bt.feed();
if (tuple_type.values.get(ip)[field_index] != .none) continue;
const field_type = Type.fromInterned(tuple_type.types.get(ip)[field_index]);
elem_disp = @intCast(field_type.abiAlignment(zcu).forward(elem_disp));
var elem = try cg.tempFromOperand(elem_ref, elem_dies);
try res.write(&elem, .{ .disp = elem_disp }, cg);
try elem.die(cg);
try cg.resetTemps(reset_index);
elem_disp += @intCast(field_type.abiSize(zcu));
if (!hack_around_sema_opv_bugs or field_type.hasRuntimeBitsIgnoreComptime(zcu)) {
elem_disp = @intCast(field_type.abiAlignment(zcu).forward(elem_disp));
var elem = try cg.tempFromOperand(elem_ref, elem_dies);
try res.write(&elem, .{ .disp = elem_disp }, cg);
try elem.die(cg);
try cg.resetTemps(reset_index);
elem_disp += @intCast(field_type.abiSize(zcu));
}
}
},
else => return cg.fail("failed to select {s} {f}", .{