| ... | @@ -2302,11 +2302,6 @@ fn airAlloc(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -2302,11 +2302,6 @@ fn airAlloc(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2302 | fn airStore(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { | 2302 | fn airStore(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { |
| 2303 | const pt = cg.pt; | 2303 | const pt = cg.pt; |
| 2304 | const zcu = pt.zcu; | 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 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 2305 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 2311 | | 2306 | |
| 2312 | const lhs = try cg.resolveInst(bin_op.lhs); | 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,6 +2310,10 @@ fn airStore(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { |
| 2315 | const ptr_info = ptr_ty.ptrInfo(zcu); | 2310 | const ptr_info = ptr_ty.ptrInfo(zcu); |
| 2316 | const ty = ptr_ty.childType(zcu); | 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 | if (ptr_info.packed_offset.host_size == 0) { | 2317 | if (ptr_info.packed_offset.host_size == 0) { |
| 2319 | try cg.store(lhs, rhs, ty, 0); | 2318 | try cg.store(lhs, rhs, ty, 0); |
| 2320 | } else { | 2319 | } else { |
| ... | @@ -4756,11 +4755,6 @@ fn airPtrBinOp(cg: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void { | ... | @@ -4756,11 +4755,6 @@ fn airPtrBinOp(cg: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void { |
| 4756 | | 4755 | |
| 4757 | fn airMemset(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { | 4756 | fn airMemset(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { |
| 4758 | const zcu = cg.pt.zcu; | 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 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 4758 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 4765 | | 4759 | |
| 4766 | const ptr = try cg.resolveInst(bin_op.lhs); | 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,6 +4771,10 @@ fn airMemset(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { |
| 4777 | else | 4771 | else |
| 4778 | ptr_ty.childType(zcu); | 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 | const dst_ptr = try cg.sliceOrArrayPtr(ptr, ptr_ty); | 4778 | const dst_ptr = try cg.sliceOrArrayPtr(ptr, ptr_ty); |
| 4781 | try cg.memset(elem_ty, dst_ptr, len, value); | 4779 | try cg.memset(elem_ty, dst_ptr, len, value); |
| 4782 | | 4780 | |