diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-05-13 16:48:24 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-05-13 16:50:27 -0700 |
| commit | e83cf6a4542b34e7fd64028a3b1b89dacdc2e166 (patch) | |
| tree | ed192b102e4ca13145623216b0e808d7f1fd6059 /src/Sema.zig | |
| parent | b109daacddf54dbe4ffcbef9041443f2759511e3 (diff) | |
| download | zig-e83cf6a4542b34e7fd64028a3b1b89dacdc2e166.tar.gz zig-e83cf6a4542b34e7fd64028a3b1b89dacdc2e166.zip | |
Sema: detect and skip over elided instructions
It would be better if AstGen would actually omit these instructions
rather than only marking them as elided, but that can be solved
separately.
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 626624110e..895ac84dd0 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -1461,6 +1461,11 @@ fn zirStoreToBlockPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) In defer tracy.end(); const bin_inst = sema.code.instructions.items(.data)[inst].bin; + if (bin_inst.lhs == .none) { + // This is an elided instruction, but AstGen was not smart enough + // to omit it. + return; + } const ptr = try sema.resolveInst(bin_inst.lhs); const value = try sema.resolveInst(bin_inst.rhs); const ptr_ty = try sema.mod.simplePtrType(sema.arena, value.ty, true, .One); |
