@@ -161505,10 +161505,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
161505
161505
for (elems, 0..) |elem_ref, field_index| {
161506
161506
const elem_dies = bt.feed();
161507
161507
if (loaded_struct.fieldIsComptime(ip, field_index)) continue;
161508
- var elem = try cg.tempFromOperand(elem_ref, elem_dies);
161509
- try res.write(&elem, .{ .disp = @intCast(loaded_struct.offsets.get(ip)[field_index]) }, cg);
161510
- try elem.die(cg);
161511
- try cg.resetTemps(reset_index);
161508
+ if (!hack_around_sema_opv_bugs or Type.fromInterned(loaded_struct.field_types.get(ip)[field_index]).hasRuntimeBitsIgnoreComptime(zcu)) {
161509
+ var elem = try cg.tempFromOperand(elem_ref, elem_dies);
161510
+ try res.write(&elem, .{ .disp = @intCast(loaded_struct.offsets.get(ip)[field_index]) }, cg);
161511
+ try elem.die(cg);
161512
+ try cg.resetTemps(reset_index);
161513
+ }
161512
161514
}
161513
161515
},
161514
161516
.@"packed" => return cg.fail("failed to select {s} {}", .{
@@ -175015,8 +175017,7 @@ fn lowerSwitchBr(
175015
175017
) !void {
175016
175018
const zcu = cg.pt.zcu;
175017
175019
const condition_ty = cg.typeOf(switch_br.operand);
175018
- const condition_int_info = cg.intInfo(condition_ty).?;
175019
- const condition_int_ty = try cg.pt.intType(condition_int_info.signedness, condition_int_info.bits);
175020
+ const unsigned_condition_ty = try cg.pt.intType(.unsigned, cg.intInfo(condition_ty).?.bits);
175020
175021
175021
175022
const ExpectedContents = extern struct {
175022
175023
liveness_deaths: [1 << 8 | 1]Air.Inst.Index,
@@ -175087,8 +175088,8 @@ fn lowerSwitchBr(
175087
175088
.{ .air_ref = Air.internedToRef(min.?.toIntern()) },
175088
175089
);
175089
175090
const else_reloc = if (switch_br.else_body_len > 0) else_reloc: {
175090
- var cond_temp = try cg.tempInit(condition_ty , condition_index);
175091
- var table_max_temp = try cg.tempFromValue(try cg.pt.intValue(condition_int_ty , table_len - 1));
175091
+ var cond_temp = try cg.tempInit(unsigned_condition_ty , condition_index);
175092
+ var table_max_temp = try cg.tempFromValue(try cg.pt.intValue(unsigned_condition_ty , table_len - 1));
175092
175093
const cc_temp = cond_temp.cmpInts(.gt, &table_max_temp, cg) catch |err| switch (err) {
175093
175094
error.SelectFailed => unreachable,
175094
175095
else => |e| return e,
@@ -175416,8 +175417,7 @@ fn airSwitchDispatch(self: *CodeGen, inst: Air.Inst.Index) !void {
175416
175417
175417
175418
if (self.loop_switches.getPtr(br.block_inst)) |table| {
175418
175419
const condition_ty = self.typeOf(br.operand);
175419
- const condition_int_info = self.intInfo(condition_ty).?;
175420
- const condition_int_ty = try self.pt.intType(condition_int_info.signedness, condition_int_info.bits);
175420
+ const unsigned_condition_ty = try self.pt.intType(.unsigned, self.intInfo(condition_ty).?.bits);
175421
175421
const condition_mcv = block_tracking.short;
175422
175422
try self.spillEflagsIfOccupied();
175423
175423
if (table.min.orderAgainstZero(self.pt.zcu).compare(.neq)) try self.genBinOpMir(
@@ -175429,8 +175429,8 @@ fn airSwitchDispatch(self: *CodeGen, inst: Air.Inst.Index) !void {
175429
175429
switch (table.else_relocs) {
175430
175430
.@"unreachable" => {},
175431
175431
.forward => |*else_relocs| {
175432
- var cond_temp = try self.tempInit(condition_ty , condition_mcv);
175433
- var table_max_temp = try self.tempFromValue(try self.pt.intValue(condition_int_ty , table.len - 1));
175432
+ var cond_temp = try self.tempInit(unsigned_condition_ty , condition_mcv);
175433
+ var table_max_temp = try self.tempFromValue(try self.pt.intValue(unsigned_condition_ty , table.len - 1));
175434
175434
const cc_temp = cond_temp.cmpInts(.gt, &table_max_temp, self) catch |err| switch (err) {
175435
175435
error.SelectFailed => unreachable,
175436
175436
else => |e| return e,
@@ -175441,8 +175441,8 @@ fn airSwitchDispatch(self: *CodeGen, inst: Air.Inst.Index) !void {
175441
175441
try cc_temp.die(self);
175442
175442
},
175443
175443
.backward => |else_reloc| {
175444
- var cond_temp = try self.tempInit(condition_ty , condition_mcv);
175445
- var table_max_temp = try self.tempFromValue(try self.pt.intValue(condition_int_ty , table.len - 1));
175444
+ var cond_temp = try self.tempInit(unsigned_condition_ty , condition_mcv);
175445
+ var table_max_temp = try self.tempFromValue(try self.pt.intValue(unsigned_condition_ty , table.len - 1));
175446
175446
const cc_temp = cond_temp.cmpInts(.gt, &table_max_temp, self) catch |err| switch (err) {
175447
175447
error.SelectFailed => unreachable,
175448
175448
else => |e| return e,
0 commit comments