Skip to content

Commit 289c704

Browse files
committed
cbe: don't emit 'x = x' in switch dispatch loop
1 parent 0d295d7 commit 289c704

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/codegen/c.zig

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5065,11 +5065,8 @@ fn airSwitchBr(f: *Function, inst: Air.Inst.Index, is_dispatch_loop: bool) !void
50655065
// amount of C code we generate, which is probably more desirable here (and is simpler).
50665066
const condition = if (is_dispatch_loop) cond: {
50675067
const new_local = try f.allocLocal(inst, condition_ty);
5068-
try f.writeCValue(writer, new_local, .Other);
5069-
try writer.writeAll(" = ");
5070-
try f.writeCValue(writer, init_condition, .Initializer);
5071-
try writer.writeAll(";\n");
5072-
try writer.print("zig_switch_{d}_loop:", .{@intFromEnum(inst)});
5068+
try f.copyCValue(try f.ctypeFromType(condition_ty, .complete), new_local, init_condition);
5069+
try writer.print("zig_switch_{d}_loop:\n", .{@intFromEnum(inst)});
50735070
try f.loop_switch_conds.put(gpa, inst, new_local.new_local);
50745071
break :cond new_local;
50755072
} else init_condition;

0 commit comments

Comments
 (0)