diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2023-03-31 16:23:01 -0400 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2023-04-02 18:05:44 +0300 |
| commit | f4b411314ccf8e852d3febddc8b31ce1f533938b (patch) | |
| tree | 41ff16cd4d9bec89e5f57be34e790017be93a4d0 /src/codegen/c.zig | |
| parent | 878163e58813aef968900aa7495dacc5220eb941 (diff) | |
| download | zig-f4b411314ccf8e852d3febddc8b31ce1f533938b.tar.gz zig-f4b411314ccf8e852d3febddc8b31ce1f533938b.zip | |
Sema: defer stores to inferred allocs
This lets us generate the store with knowledge of the type to be stored.
Therefore, we can avoid generating garbage Air with stores through
pointers to comptime-only types which backends cannot lower.
Closes #13410
Closes #15122
Diffstat (limited to 'src/codegen/c.zig')
| -rw-r--r-- | src/codegen/c.zig | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 704a1e31c5..a3758bac69 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -3597,10 +3597,6 @@ fn airStore(f: *Function, inst: Air.Inst.Index) !CValue { const ptr_ty = f.air.typeOf(bin_op.lhs); const ptr_scalar_ty = ptr_ty.scalarType(); const ptr_info = ptr_scalar_ty.ptrInfo().data; - if (!ptr_info.pointee_type.hasRuntimeBitsIgnoreComptime()) { - try reap(f, inst, &.{ bin_op.lhs, bin_op.rhs }); - return .none; - } const ptr_val = try f.resolveInst(bin_op.lhs); const src_ty = f.air.typeOf(bin_op.rhs); @@ -4461,9 +4457,7 @@ fn airBr(f: *Function, inst: Air.Inst.Index) !CValue { fn airBitcast(f: *Function, inst: Air.Inst.Index) !CValue { const ty_op = f.air.instructions.items(.data)[inst].ty_op; const dest_ty = f.air.typeOfIndex(inst); - // No IgnoreComptime until Sema stops giving us garbage Air. - // https://github.com/ziglang/zig/issues/13410 - if (f.liveness.isUnused(inst) or !dest_ty.hasRuntimeBits()) { + if (f.liveness.isUnused(inst)) { try reap(f, inst, &.{ty_op.operand}); return .none; } |
