| ... | ... | @@ -2302,11 +2302,6 @@ fn airAlloc(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2302 | 2302 | fn airStore(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { |
| 2303 | 2303 | const pt = cg.pt; |
| 2304 | 2304 | const zcu = pt.zcu; |
| 2305 | | if (safety) { |
| 2306 | | // TODO if the value is undef, write 0xaa bytes to dest |
| 2307 | | } else { |
| 2308 | | // TODO if the value is undef, don't lower this instruction |
| 2309 | | } |
| 2310 | 2305 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 2311 | 2306 | |
| 2312 | 2307 | const lhs = try cg.resolveInst(bin_op.lhs); |
| ... | ... | @@ -2315,6 +2310,10 @@ fn airStore(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { |
| 2315 | 2310 | const ptr_info = ptr_ty.ptrInfo(zcu); |
| 2316 | 2311 | const ty = ptr_ty.childType(zcu); |
| 2317 | 2312 | |
| 2313 | if (!safety and bin_op.rhs == .undef) { |
| 2314 | return cg.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); |
| 2315 | } |
| 2316 | |
| 2318 | 2317 | if (ptr_info.packed_offset.host_size == 0) { |
| 2319 | 2318 | try cg.store(lhs, rhs, ty, 0); |
| 2320 | 2319 | } else { |
| ... | ... | @@ -4756,11 +4755,6 @@ fn airPtrBinOp(cg: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void { |
| 4756 | 4755 | |
| 4757 | 4756 | fn airMemset(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { |
| 4758 | 4757 | const zcu = cg.pt.zcu; |
| 4759 | | if (safety) { |
| 4760 | | // TODO if the value is undef, write 0xaa bytes to dest |
| 4761 | | } else { |
| 4762 | | // TODO if the value is undef, don't lower this instruction |
| 4763 | | } |
| 4764 | 4758 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 4765 | 4759 | |
| 4766 | 4760 | const ptr = try cg.resolveInst(bin_op.lhs); |
| ... | ... | @@ -4777,6 +4771,10 @@ fn airMemset(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { |
| 4777 | 4771 | else |
| 4778 | 4772 | ptr_ty.childType(zcu); |
| 4779 | 4773 | |
| 4774 | if (!safety and bin_op.rhs == .undef) { |
| 4775 | return cg.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); |
| 4776 | } |
| 4777 | |
| 4780 | 4778 | const dst_ptr = try cg.sliceOrArrayPtr(ptr, ptr_ty); |
| 4781 | 4779 | try cg.memset(elem_ty, dst_ptr, len, value); |
| 4782 | 4780 | |