# Sema: avoid emitting sequential dbg_stmt instructions · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/3df2f356eba9b0882ee3fa09704aae7dc173f3d4)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 3df2f356eba9b0882ee3fa09704aae7dc173f3d4

Requested commit: 3df2f356eba9b0882ee3fa09704aae7dc173f3d4

Commit: 3df2f356eba9b0882ee3fa09704aae7dc173f3d4

Tree: 8148aa73bb87733ef5c221c0ebf60a9c07cfd657

Author: mlugg

Committer: mlugg

## Message

```
Sema: avoid emitting sequential dbg_stmt instructions

Often, a `dbg_stmt` ends up being associated with no real code because
whatever it referred to was eliminated by semantic analysis. In these
cases, Sema can replace the last `dbg_stmt` with the new one to avoid
redundant AIR instructions which at best are nops and at worst cause
backends to emit useless info (e.g. CBE does this).

```

## Parents

- [2e23ddbe7ba48857fbdcf014da3251f1decca00d](https://git.cafe/gitcafe/zig/commit/2e23ddbe7ba48857fbdcf014da3251f1decca00d?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/3df2f356eba9b0882ee3fa09704aae7dc173f3d4?format=markdown)
