authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-09-01 20:31:01+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-09-01 20:31:01+01:00
log289c704b60c3e4b65bc00be55266b3f1c3fc27a3
tree94c99c5a19ffe119259fdf89c9b454fb6c5b8a0f
parent0d295d76358037c15d9dc1f56b7b43de29a94d8d
signaturelock-open Commit is signed but in an unrecognized format.

cbe: don't emit 'x = x' in switch dispatch loop


1 files changed, 2 insertions(+), 5 deletions(-)

src/codegen/c.zig+2-5
......@@ -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;