diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-04-26 17:09:04 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-26 17:09:04 -0700 |
| commit | afbcad9939169f0b9b9b8ecb287718023c58b428 (patch) | |
| tree | f26a4b4e953c5db2de39839e05b6d9bbbf401368 /src/Sema.zig | |
| parent | f618398b24acdc3317e6fd81f486d49176ffcef9 (diff) | |
| parent | 3df2f356eba9b0882ee3fa09704aae7dc173f3d4 (diff) | |
| download | zig-afbcad9939169f0b9b9b8ecb287718023c58b428.tar.gz zig-afbcad9939169f0b9b9b8ecb287718023c58b428.zip | |
Merge pull request #15452 from mlugg/zig-cbe-opt
CBE: minor optimizations to output source
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 7fd564095b..14c1789858 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -5888,6 +5888,19 @@ fn zirDbgStmt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!voi if (block.is_comptime or sema.mod.comp.bin_file.options.strip) return; const inst_data = sema.code.instructions.items(.data)[inst].dbg_stmt; + + if (block.instructions.items.len != 0) { + const idx = block.instructions.items[block.instructions.items.len - 1]; + if (sema.air_instructions.items(.tag)[idx] == .dbg_stmt) { + // The previous dbg_stmt didn't correspond to any actual code, so replace it. + sema.air_instructions.items(.data)[idx].dbg_stmt = .{ + .line = inst_data.line, + .column = inst_data.column, + }; + return; + } + } + _ = try block.addInst(.{ .tag = .dbg_stmt, .data = .{ .dbg_stmt = .{ |
