| ... | @@ -4523,6 +4523,10 @@ pub const FuncGen = struct { | ... | @@ -4523,6 +4523,10 @@ pub const FuncGen = struct { |
| 4523 | fn genBody(self: *FuncGen, body: []const Air.Inst.Index) Error!void { | 4523 | fn genBody(self: *FuncGen, body: []const Air.Inst.Index) Error!void { |
| 4524 | const air_tags = self.air.instructions.items(.tag); | 4524 | const air_tags = self.air.instructions.items(.tag); |
| 4525 | for (body, 0..) |inst, i| { | 4525 | for (body, 0..) |inst, i| { |
| | 4526 | if (self.liveness.isUnused(inst) and !self.air.mustLower(inst)) { |
| | 4527 | continue; |
| | 4528 | } |
| | 4529 | |
| 4526 | const opt_value: ?*llvm.Value = switch (air_tags[inst]) { | 4530 | const opt_value: ?*llvm.Value = switch (air_tags[inst]) { |
| 4527 | // zig fmt: off | 4531 | // zig fmt: off |
| 4528 | .add => try self.airAdd(inst, false), | 4532 | .add => try self.airAdd(inst, false), |
| ... | @@ -5166,8 +5170,6 @@ pub const FuncGen = struct { | ... | @@ -5166,8 +5170,6 @@ pub const FuncGen = struct { |
| 5166 | } | 5170 | } |
| 5167 | | 5171 | |
| 5168 | fn airCVaArg(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 5172 | fn airCVaArg(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 5169 | if (self.liveness.isUnused(inst)) return null; | | |
| 5170 | | | |
| 5171 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 5173 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 5172 | const list = try self.resolveInst(ty_op.operand); | 5174 | const list = try self.resolveInst(ty_op.operand); |
| 5173 | const arg_ty = self.air.getRefType(ty_op.ty); | 5175 | const arg_ty = self.air.getRefType(ty_op.ty); |
| ... | @@ -5177,8 +5179,6 @@ pub const FuncGen = struct { | ... | @@ -5177,8 +5179,6 @@ pub const FuncGen = struct { |
| 5177 | } | 5179 | } |
| 5178 | | 5180 | |
| 5179 | fn airCVaCopy(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 5181 | fn airCVaCopy(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 5180 | if (self.liveness.isUnused(inst)) return null; | | |
| 5181 | | | |
| 5182 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 5182 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 5183 | const src_list = try self.resolveInst(ty_op.operand); | 5183 | const src_list = try self.resolveInst(ty_op.operand); |
| 5184 | const va_list_ty = self.air.getRefType(ty_op.ty); | 5184 | const va_list_ty = self.air.getRefType(ty_op.ty); |
| ... | @@ -5226,8 +5226,6 @@ pub const FuncGen = struct { | ... | @@ -5226,8 +5226,6 @@ pub const FuncGen = struct { |
| 5226 | } | 5226 | } |
| 5227 | | 5227 | |
| 5228 | fn airCVaStart(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 5228 | fn airCVaStart(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 5229 | if (self.liveness.isUnused(inst)) return null; | | |
| 5230 | | | |
| 5231 | const va_list_ty = self.air.typeOfIndex(inst); | 5229 | const va_list_ty = self.air.typeOfIndex(inst); |
| 5232 | const llvm_va_list_ty = try self.dg.lowerType(va_list_ty); | 5230 | const llvm_va_list_ty = try self.dg.lowerType(va_list_ty); |
| 5233 | | 5231 | |
| ... | @@ -5254,7 +5252,6 @@ pub const FuncGen = struct { | ... | @@ -5254,7 +5252,6 @@ pub const FuncGen = struct { |
| 5254 | } | 5252 | } |
| 5255 | | 5253 | |
| 5256 | fn airCmp(self: *FuncGen, inst: Air.Inst.Index, op: math.CompareOperator, want_fast_math: bool) !?*llvm.Value { | 5254 | fn airCmp(self: *FuncGen, inst: Air.Inst.Index, op: math.CompareOperator, want_fast_math: bool) !?*llvm.Value { |
| 5257 | if (self.liveness.isUnused(inst)) return null; | | |
| 5258 | self.builder.setFastMath(want_fast_math); | 5255 | self.builder.setFastMath(want_fast_math); |
| 5259 | | 5256 | |
| 5260 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 5257 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| ... | @@ -5266,7 +5263,6 @@ pub const FuncGen = struct { | ... | @@ -5266,7 +5263,6 @@ pub const FuncGen = struct { |
| 5266 | } | 5263 | } |
| 5267 | | 5264 | |
| 5268 | fn airCmpVector(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { | 5265 | fn airCmpVector(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { |
| 5269 | if (self.liveness.isUnused(inst)) return null; | | |
| 5270 | self.builder.setFastMath(want_fast_math); | 5266 | self.builder.setFastMath(want_fast_math); |
| 5271 | | 5267 | |
| 5272 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | 5268 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| ... | @@ -5281,8 +5277,6 @@ pub const FuncGen = struct { | ... | @@ -5281,8 +5277,6 @@ pub const FuncGen = struct { |
| 5281 | } | 5277 | } |
| 5282 | | 5278 | |
| 5283 | fn airCmpLtErrorsLen(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 5279 | fn airCmpLtErrorsLen(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 5284 | if (self.liveness.isUnused(inst)) return null; | | |
| 5285 | | | |
| 5286 | const un_op = self.air.instructions.items(.data)[inst].un_op; | 5280 | const un_op = self.air.instructions.items(.data)[inst].un_op; |
| 5287 | const operand = try self.resolveInst(un_op); | 5281 | const operand = try self.resolveInst(un_op); |
| 5288 | const llvm_fn = try self.getCmpLtErrorsLenFunction(); | 5282 | const llvm_fn = try self.getCmpLtErrorsLenFunction(); |
| ... | @@ -5650,9 +5644,6 @@ pub const FuncGen = struct { | ... | @@ -5650,9 +5644,6 @@ pub const FuncGen = struct { |
| 5650 | } | 5644 | } |
| 5651 | | 5645 | |
| 5652 | fn airArrayToSlice(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 5646 | fn airArrayToSlice(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 5653 | if (self.liveness.isUnused(inst)) | | |
| 5654 | return null; | | |
| 5655 | | | |
| 5656 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 5647 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 5657 | const operand_ty = self.air.typeOf(ty_op.operand); | 5648 | const operand_ty = self.air.typeOf(ty_op.operand); |
| 5658 | const array_ty = operand_ty.childType(); | 5649 | const array_ty = operand_ty.childType(); |
| ... | @@ -5674,9 +5665,6 @@ pub const FuncGen = struct { | ... | @@ -5674,9 +5665,6 @@ pub const FuncGen = struct { |
| 5674 | } | 5665 | } |
| 5675 | | 5666 | |
| 5676 | fn airIntToFloat(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 5667 | fn airIntToFloat(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 5677 | if (self.liveness.isUnused(inst)) | | |
| 5678 | return null; | | |
| 5679 | | | |
| 5680 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 5668 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 5681 | | 5669 | |
| 5682 | const operand = try self.resolveInst(ty_op.operand); | 5670 | const operand = try self.resolveInst(ty_op.operand); |
| ... | @@ -5733,9 +5721,6 @@ pub const FuncGen = struct { | ... | @@ -5733,9 +5721,6 @@ pub const FuncGen = struct { |
| 5733 | } | 5721 | } |
| 5734 | | 5722 | |
| 5735 | fn airFloatToInt(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { | 5723 | fn airFloatToInt(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { |
| 5736 | if (self.liveness.isUnused(inst)) | | |
| 5737 | return null; | | |
| 5738 | | | |
| 5739 | self.builder.setFastMath(want_fast_math); | 5724 | self.builder.setFastMath(want_fast_math); |
| 5740 | | 5725 | |
| 5741 | const target = self.dg.module.getTarget(); | 5726 | const target = self.dg.module.getTarget(); |
| ... | @@ -5792,16 +5777,12 @@ pub const FuncGen = struct { | ... | @@ -5792,16 +5777,12 @@ pub const FuncGen = struct { |
| 5792 | } | 5777 | } |
| 5793 | | 5778 | |
| 5794 | fn airSliceField(self: *FuncGen, inst: Air.Inst.Index, index: c_uint) !?*llvm.Value { | 5779 | fn airSliceField(self: *FuncGen, inst: Air.Inst.Index, index: c_uint) !?*llvm.Value { |
| 5795 | if (self.liveness.isUnused(inst)) return null; | | |
| 5796 | | | |
| 5797 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 5780 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 5798 | const operand = try self.resolveInst(ty_op.operand); | 5781 | const operand = try self.resolveInst(ty_op.operand); |
| 5799 | return self.builder.buildExtractValue(operand, index, ""); | 5782 | return self.builder.buildExtractValue(operand, index, ""); |
| 5800 | } | 5783 | } |
| 5801 | | 5784 | |
| 5802 | fn airPtrSliceFieldPtr(self: *FuncGen, inst: Air.Inst.Index, index: c_uint) !?*llvm.Value { | 5785 | fn airPtrSliceFieldPtr(self: *FuncGen, inst: Air.Inst.Index, index: c_uint) !?*llvm.Value { |
| 5803 | if (self.liveness.isUnused(inst)) return null; | | |
| 5804 | | | |
| 5805 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 5786 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 5806 | const slice_ptr = try self.resolveInst(ty_op.operand); | 5787 | const slice_ptr = try self.resolveInst(ty_op.operand); |
| 5807 | const slice_ptr_ty = self.air.typeOf(ty_op.operand); | 5788 | const slice_ptr_ty = self.air.typeOf(ty_op.operand); |
| ... | @@ -5814,8 +5795,6 @@ pub const FuncGen = struct { | ... | @@ -5814,8 +5795,6 @@ pub const FuncGen = struct { |
| 5814 | const inst = body_tail[0]; | 5795 | const inst = body_tail[0]; |
| 5815 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 5796 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 5816 | const slice_ty = self.air.typeOf(bin_op.lhs); | 5797 | const slice_ty = self.air.typeOf(bin_op.lhs); |
| 5817 | if (!slice_ty.isVolatilePtr() and self.liveness.isUnused(inst)) return null; | | |
| 5818 | | | |
| 5819 | const slice = try self.resolveInst(bin_op.lhs); | 5798 | const slice = try self.resolveInst(bin_op.lhs); |
| 5820 | const index = try self.resolveInst(bin_op.rhs); | 5799 | const index = try self.resolveInst(bin_op.rhs); |
| 5821 | const elem_ty = slice_ty.childType(); | 5800 | const elem_ty = slice_ty.childType(); |
| ... | @@ -5835,7 +5814,6 @@ pub const FuncGen = struct { | ... | @@ -5835,7 +5814,6 @@ pub const FuncGen = struct { |
| 5835 | } | 5814 | } |
| 5836 | | 5815 | |
| 5837 | fn airSliceElemPtr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 5816 | fn airSliceElemPtr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 5838 | if (self.liveness.isUnused(inst)) return null; | | |
| 5839 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | 5817 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 5840 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | 5818 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 5841 | const slice_ty = self.air.typeOf(bin_op.lhs); | 5819 | const slice_ty = self.air.typeOf(bin_op.lhs); |
| ... | @@ -5850,7 +5828,6 @@ pub const FuncGen = struct { | ... | @@ -5850,7 +5828,6 @@ pub const FuncGen = struct { |
| 5850 | | 5828 | |
| 5851 | fn airArrayElemVal(self: *FuncGen, body_tail: []const Air.Inst.Index) !?*llvm.Value { | 5829 | fn airArrayElemVal(self: *FuncGen, body_tail: []const Air.Inst.Index) !?*llvm.Value { |
| 5852 | const inst = body_tail[0]; | 5830 | const inst = body_tail[0]; |
| 5853 | if (self.liveness.isUnused(inst)) return null; | | |
| 5854 | | 5831 | |
| 5855 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 5832 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 5856 | const array_ty = self.air.typeOf(bin_op.lhs); | 5833 | const array_ty = self.air.typeOf(bin_op.lhs); |
| ... | @@ -5881,8 +5858,6 @@ pub const FuncGen = struct { | ... | @@ -5881,8 +5858,6 @@ pub const FuncGen = struct { |
| 5881 | const inst = body_tail[0]; | 5858 | const inst = body_tail[0]; |
| 5882 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 5859 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 5883 | const ptr_ty = self.air.typeOf(bin_op.lhs); | 5860 | const ptr_ty = self.air.typeOf(bin_op.lhs); |
| 5884 | if (!ptr_ty.isVolatilePtr() and self.liveness.isUnused(inst)) return null; | | |
| 5885 | | | |
| 5886 | const elem_ty = ptr_ty.childType(); | 5861 | const elem_ty = ptr_ty.childType(); |
| 5887 | const llvm_elem_ty = try self.dg.lowerPtrElemTy(elem_ty); | 5862 | const llvm_elem_ty = try self.dg.lowerPtrElemTy(elem_ty); |
| 5888 | const base_ptr = try self.resolveInst(bin_op.lhs); | 5863 | const base_ptr = try self.resolveInst(bin_op.lhs); |
| ... | @@ -5908,8 +5883,6 @@ pub const FuncGen = struct { | ... | @@ -5908,8 +5883,6 @@ pub const FuncGen = struct { |
| 5908 | } | 5883 | } |
| 5909 | | 5884 | |
| 5910 | fn airPtrElemPtr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 5885 | fn airPtrElemPtr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 5911 | if (self.liveness.isUnused(inst)) return null; | | |
| 5912 | | | |
| 5913 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | 5886 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 5914 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | 5887 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 5915 | const ptr_ty = self.air.typeOf(bin_op.lhs); | 5888 | const ptr_ty = self.air.typeOf(bin_op.lhs); |
| ... | @@ -5934,9 +5907,6 @@ pub const FuncGen = struct { | ... | @@ -5934,9 +5907,6 @@ pub const FuncGen = struct { |
| 5934 | } | 5907 | } |
| 5935 | | 5908 | |
| 5936 | fn airStructFieldPtr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 5909 | fn airStructFieldPtr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 5937 | if (self.liveness.isUnused(inst)) | | |
| 5938 | return null; | | |
| 5939 | | | |
| 5940 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | 5910 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 5941 | const struct_field = self.air.extraData(Air.StructField, ty_pl.payload).data; | 5911 | const struct_field = self.air.extraData(Air.StructField, ty_pl.payload).data; |
| 5942 | const struct_ptr = try self.resolveInst(struct_field.struct_operand); | 5912 | const struct_ptr = try self.resolveInst(struct_field.struct_operand); |
| ... | @@ -5949,8 +5919,6 @@ pub const FuncGen = struct { | ... | @@ -5949,8 +5919,6 @@ pub const FuncGen = struct { |
| 5949 | inst: Air.Inst.Index, | 5919 | inst: Air.Inst.Index, |
| 5950 | field_index: u32, | 5920 | field_index: u32, |
| 5951 | ) !?*llvm.Value { | 5921 | ) !?*llvm.Value { |
| 5952 | if (self.liveness.isUnused(inst)) return null; | | |
| 5953 | | | |
| 5954 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 5922 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 5955 | const struct_ptr = try self.resolveInst(ty_op.operand); | 5923 | const struct_ptr = try self.resolveInst(ty_op.operand); |
| 5956 | const struct_ptr_ty = self.air.typeOf(ty_op.operand); | 5924 | const struct_ptr_ty = self.air.typeOf(ty_op.operand); |
| ... | @@ -5959,8 +5927,6 @@ pub const FuncGen = struct { | ... | @@ -5959,8 +5927,6 @@ pub const FuncGen = struct { |
| 5959 | | 5927 | |
| 5960 | fn airStructFieldVal(self: *FuncGen, body_tail: []const Air.Inst.Index) !?*llvm.Value { | 5928 | fn airStructFieldVal(self: *FuncGen, body_tail: []const Air.Inst.Index) !?*llvm.Value { |
| 5961 | const inst = body_tail[0]; | 5929 | const inst = body_tail[0]; |
| 5962 | if (self.liveness.isUnused(inst)) return null; | | |
| 5963 | | | |
| 5964 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | 5930 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 5965 | const struct_field = self.air.extraData(Air.StructField, ty_pl.payload).data; | 5931 | const struct_field = self.air.extraData(Air.StructField, ty_pl.payload).data; |
| 5966 | const struct_ty = self.air.typeOf(struct_field.struct_operand); | 5932 | const struct_ty = self.air.typeOf(struct_field.struct_operand); |
| ... | @@ -6060,8 +6026,6 @@ pub const FuncGen = struct { | ... | @@ -6060,8 +6026,6 @@ pub const FuncGen = struct { |
| 6060 | } | 6026 | } |
| 6061 | | 6027 | |
| 6062 | fn airFieldParentPtr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 6028 | fn airFieldParentPtr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 6063 | if (self.liveness.isUnused(inst)) return null; | | |
| 6064 | | | |
| 6065 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | 6029 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 6066 | const extra = self.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; | 6030 | const extra = self.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 6067 | | 6031 | |
| ... | @@ -6083,9 +6047,6 @@ pub const FuncGen = struct { | ... | @@ -6083,9 +6047,6 @@ pub const FuncGen = struct { |
| 6083 | } | 6047 | } |
| 6084 | | 6048 | |
| 6085 | fn airNot(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 6049 | fn airNot(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 6086 | if (self.liveness.isUnused(inst)) | | |
| 6087 | return null; | | |
| 6088 | | | |
| 6089 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 6050 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 6090 | const operand = try self.resolveInst(ty_op.operand); | 6051 | const operand = try self.resolveInst(ty_op.operand); |
| 6091 | | 6052 | |
| ... | @@ -6263,8 +6224,6 @@ pub const FuncGen = struct { | ... | @@ -6263,8 +6224,6 @@ pub const FuncGen = struct { |
| 6263 | const clobbers_len = @truncate(u31, extra.data.flags); | 6224 | const clobbers_len = @truncate(u31, extra.data.flags); |
| 6264 | var extra_i: usize = extra.end; | 6225 | var extra_i: usize = extra.end; |
| 6265 | | 6226 | |
| 6266 | if (!is_volatile and self.liveness.isUnused(inst)) return null; | | |
| 6267 | | | |
| 6268 | const outputs = @ptrCast([]const Air.Inst.Ref, self.air.extra[extra_i..][0..extra.data.outputs_len]); | 6227 | const outputs = @ptrCast([]const Air.Inst.Ref, self.air.extra[extra_i..][0..extra.data.outputs_len]); |
| 6269 | extra_i += outputs.len; | 6228 | extra_i += outputs.len; |
| 6270 | const inputs = @ptrCast([]const Air.Inst.Ref, self.air.extra[extra_i..][0..extra.data.inputs_len]); | 6229 | const inputs = @ptrCast([]const Air.Inst.Ref, self.air.extra[extra_i..][0..extra.data.inputs_len]); |
| ... | @@ -6610,8 +6569,6 @@ pub const FuncGen = struct { | ... | @@ -6610,8 +6569,6 @@ pub const FuncGen = struct { |
| 6610 | operand_is_ptr: bool, | 6569 | operand_is_ptr: bool, |
| 6611 | pred: llvm.IntPredicate, | 6570 | pred: llvm.IntPredicate, |
| 6612 | ) !?*llvm.Value { | 6571 | ) !?*llvm.Value { |
| 6613 | if (self.liveness.isUnused(inst)) return null; | | |
| 6614 | | | |
| 6615 | const un_op = self.air.instructions.items(.data)[inst].un_op; | 6572 | const un_op = self.air.instructions.items(.data)[inst].un_op; |
| 6616 | const operand = try self.resolveInst(un_op); | 6573 | const operand = try self.resolveInst(un_op); |
| 6617 | const operand_ty = self.air.typeOf(un_op); | 6574 | const operand_ty = self.air.typeOf(un_op); |
| ... | @@ -6659,8 +6616,6 @@ pub const FuncGen = struct { | ... | @@ -6659,8 +6616,6 @@ pub const FuncGen = struct { |
| 6659 | op: llvm.IntPredicate, | 6616 | op: llvm.IntPredicate, |
| 6660 | operand_is_ptr: bool, | 6617 | operand_is_ptr: bool, |
| 6661 | ) !?*llvm.Value { | 6618 | ) !?*llvm.Value { |
| 6662 | if (self.liveness.isUnused(inst)) return null; | | |
| 6663 | | | |
| 6664 | const un_op = self.air.instructions.items(.data)[inst].un_op; | 6619 | const un_op = self.air.instructions.items(.data)[inst].un_op; |
| 6665 | const operand = try self.resolveInst(un_op); | 6620 | const operand = try self.resolveInst(un_op); |
| 6666 | const operand_ty = self.air.typeOf(un_op); | 6621 | const operand_ty = self.air.typeOf(un_op); |
| ... | @@ -6701,8 +6656,6 @@ pub const FuncGen = struct { | ... | @@ -6701,8 +6656,6 @@ pub const FuncGen = struct { |
| 6701 | } | 6656 | } |
| 6702 | | 6657 | |
| 6703 | fn airOptionalPayloadPtr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 6658 | fn airOptionalPayloadPtr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 6704 | if (self.liveness.isUnused(inst)) return null; | | |
| 6705 | | | |
| 6706 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 6659 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 6707 | const operand = try self.resolveInst(ty_op.operand); | 6660 | const operand = try self.resolveInst(ty_op.operand); |
| 6708 | const optional_ty = self.air.typeOf(ty_op.operand).childType(); | 6661 | const optional_ty = self.air.typeOf(ty_op.operand).childType(); |
| ... | @@ -6756,8 +6709,6 @@ pub const FuncGen = struct { | ... | @@ -6756,8 +6709,6 @@ pub const FuncGen = struct { |
| 6756 | | 6709 | |
| 6757 | fn airOptionalPayload(self: *FuncGen, body_tail: []const Air.Inst.Index) !?*llvm.Value { | 6710 | fn airOptionalPayload(self: *FuncGen, body_tail: []const Air.Inst.Index) !?*llvm.Value { |
| 6758 | const inst = body_tail[0]; | 6711 | const inst = body_tail[0]; |
| 6759 | if (self.liveness.isUnused(inst)) return null; | | |
| 6760 | | | |
| 6761 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 6712 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 6762 | const operand = try self.resolveInst(ty_op.operand); | 6713 | const operand = try self.resolveInst(ty_op.operand); |
| 6763 | const optional_ty = self.air.typeOf(ty_op.operand); | 6714 | const optional_ty = self.air.typeOf(ty_op.operand); |
| ... | @@ -6780,8 +6731,6 @@ pub const FuncGen = struct { | ... | @@ -6780,8 +6731,6 @@ pub const FuncGen = struct { |
| 6780 | operand_is_ptr: bool, | 6731 | operand_is_ptr: bool, |
| 6781 | ) !?*llvm.Value { | 6732 | ) !?*llvm.Value { |
| 6782 | const inst = body_tail[0]; | 6733 | const inst = body_tail[0]; |
| 6783 | if (self.liveness.isUnused(inst)) return null; | | |
| 6784 | | | |
| 6785 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 6734 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 6786 | const operand = try self.resolveInst(ty_op.operand); | 6735 | const operand = try self.resolveInst(ty_op.operand); |
| 6787 | const operand_ty = self.air.typeOf(ty_op.operand); | 6736 | const operand_ty = self.air.typeOf(ty_op.operand); |
| ... | @@ -6817,9 +6766,6 @@ pub const FuncGen = struct { | ... | @@ -6817,9 +6766,6 @@ pub const FuncGen = struct { |
| 6817 | inst: Air.Inst.Index, | 6766 | inst: Air.Inst.Index, |
| 6818 | operand_is_ptr: bool, | 6767 | operand_is_ptr: bool, |
| 6819 | ) !?*llvm.Value { | 6768 | ) !?*llvm.Value { |
| 6820 | if (self.liveness.isUnused(inst)) | | |
| 6821 | return null; | | |
| 6822 | | | |
| 6823 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 6769 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 6824 | const operand = try self.resolveInst(ty_op.operand); | 6770 | const operand = try self.resolveInst(ty_op.operand); |
| 6825 | const operand_ty = self.air.typeOf(ty_op.operand); | 6771 | const operand_ty = self.air.typeOf(ty_op.operand); |
| ... | @@ -6893,8 +6839,6 @@ pub const FuncGen = struct { | ... | @@ -6893,8 +6839,6 @@ pub const FuncGen = struct { |
| 6893 | } | 6839 | } |
| 6894 | | 6840 | |
| 6895 | fn airSaveErrReturnTraceIndex(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 6841 | fn airSaveErrReturnTraceIndex(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 6896 | if (self.liveness.isUnused(inst)) return null; | | |
| 6897 | | | |
| 6898 | const target = self.dg.module.getTarget(); | 6842 | const target = self.dg.module.getTarget(); |
| 6899 | | 6843 | |
| 6900 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | 6844 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| ... | @@ -6911,8 +6855,6 @@ pub const FuncGen = struct { | ... | @@ -6911,8 +6855,6 @@ pub const FuncGen = struct { |
| 6911 | } | 6855 | } |
| 6912 | | 6856 | |
| 6913 | fn airWrapOptional(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 6857 | fn airWrapOptional(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 6914 | if (self.liveness.isUnused(inst)) return null; | | |
| 6915 | | | |
| 6916 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 6858 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 6917 | const payload_ty = self.air.typeOf(ty_op.operand); | 6859 | const payload_ty = self.air.typeOf(ty_op.operand); |
| 6918 | const non_null_bit = self.context.intType(8).constInt(1, .False); | 6860 | const non_null_bit = self.context.intType(8).constInt(1, .False); |
| ... | @@ -6943,8 +6885,6 @@ pub const FuncGen = struct { | ... | @@ -6943,8 +6885,6 @@ pub const FuncGen = struct { |
| 6943 | } | 6885 | } |
| 6944 | | 6886 | |
| 6945 | fn airWrapErrUnionPayload(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 6887 | fn airWrapErrUnionPayload(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 6946 | if (self.liveness.isUnused(inst)) return null; | | |
| 6947 | | | |
| 6948 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 6888 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 6949 | const err_un_ty = self.air.typeOfIndex(inst); | 6889 | const err_un_ty = self.air.typeOfIndex(inst); |
| 6950 | const operand = try self.resolveInst(ty_op.operand); | 6890 | const operand = try self.resolveInst(ty_op.operand); |
| ... | @@ -6978,8 +6918,6 @@ pub const FuncGen = struct { | ... | @@ -6978,8 +6918,6 @@ pub const FuncGen = struct { |
| 6978 | } | 6918 | } |
| 6979 | | 6919 | |
| 6980 | fn airWrapErrUnionErr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 6920 | fn airWrapErrUnionErr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 6981 | if (self.liveness.isUnused(inst)) return null; | | |
| 6982 | | | |
| 6983 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 6921 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 6984 | const err_un_ty = self.air.typeOfIndex(inst); | 6922 | const err_un_ty = self.air.typeOfIndex(inst); |
| 6985 | const payload_ty = err_un_ty.errorUnionPayload(); | 6923 | const payload_ty = err_un_ty.errorUnionPayload(); |
| ... | @@ -7015,8 +6953,6 @@ pub const FuncGen = struct { | ... | @@ -7015,8 +6953,6 @@ pub const FuncGen = struct { |
| 7015 | } | 6953 | } |
| 7016 | | 6954 | |
| 7017 | fn airWasmMemorySize(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 6955 | fn airWasmMemorySize(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7018 | if (self.liveness.isUnused(inst)) return null; | | |
| 7019 | | | |
| 7020 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; | 6956 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; |
| 7021 | const index = pl_op.payload; | 6957 | const index = pl_op.payload; |
| 7022 | const llvm_u32 = self.context.intType(32); | 6958 | const llvm_u32 = self.context.intType(32); |
| ... | @@ -7061,8 +6997,6 @@ pub const FuncGen = struct { | ... | @@ -7061,8 +6997,6 @@ pub const FuncGen = struct { |
| 7061 | } | 6997 | } |
| 7062 | | 6998 | |
| 7063 | fn airMin(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 6999 | fn airMin(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7064 | if (self.liveness.isUnused(inst)) return null; | | |
| 7065 | | | |
| 7066 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7000 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 7067 | const lhs = try self.resolveInst(bin_op.lhs); | 7001 | const lhs = try self.resolveInst(bin_op.lhs); |
| 7068 | const rhs = try self.resolveInst(bin_op.rhs); | 7002 | const rhs = try self.resolveInst(bin_op.rhs); |
| ... | @@ -7074,8 +7008,6 @@ pub const FuncGen = struct { | ... | @@ -7074,8 +7008,6 @@ pub const FuncGen = struct { |
| 7074 | } | 7008 | } |
| 7075 | | 7009 | |
| 7076 | fn airMax(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7010 | fn airMax(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7077 | if (self.liveness.isUnused(inst)) return null; | | |
| 7078 | | | |
| 7079 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7011 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 7080 | const lhs = try self.resolveInst(bin_op.lhs); | 7012 | const lhs = try self.resolveInst(bin_op.lhs); |
| 7081 | const rhs = try self.resolveInst(bin_op.rhs); | 7013 | const rhs = try self.resolveInst(bin_op.rhs); |
| ... | @@ -7087,8 +7019,6 @@ pub const FuncGen = struct { | ... | @@ -7087,8 +7019,6 @@ pub const FuncGen = struct { |
| 7087 | } | 7019 | } |
| 7088 | | 7020 | |
| 7089 | fn airSlice(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7021 | fn airSlice(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7090 | if (self.liveness.isUnused(inst)) return null; | | |
| 7091 | | | |
| 7092 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | 7022 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 7093 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | 7023 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 7094 | const ptr = try self.resolveInst(bin_op.lhs); | 7024 | const ptr = try self.resolveInst(bin_op.lhs); |
| ... | @@ -7103,7 +7033,6 @@ pub const FuncGen = struct { | ... | @@ -7103,7 +7033,6 @@ pub const FuncGen = struct { |
| 7103 | } | 7033 | } |
| 7104 | | 7034 | |
| 7105 | fn airAdd(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { | 7035 | fn airAdd(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { |
| 7106 | if (self.liveness.isUnused(inst)) return null; | | |
| 7107 | self.builder.setFastMath(want_fast_math); | 7036 | self.builder.setFastMath(want_fast_math); |
| 7108 | | 7037 | |
| 7109 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7038 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| ... | @@ -7118,7 +7047,6 @@ pub const FuncGen = struct { | ... | @@ -7118,7 +7047,6 @@ pub const FuncGen = struct { |
| 7118 | } | 7047 | } |
| 7119 | | 7048 | |
| 7120 | fn airAddWrap(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { | 7049 | fn airAddWrap(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { |
| 7121 | if (self.liveness.isUnused(inst)) return null; | | |
| 7122 | self.builder.setFastMath(want_fast_math); | 7050 | self.builder.setFastMath(want_fast_math); |
| 7123 | | 7051 | |
| 7124 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7052 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| ... | @@ -7129,8 +7057,6 @@ pub const FuncGen = struct { | ... | @@ -7129,8 +7057,6 @@ pub const FuncGen = struct { |
| 7129 | } | 7057 | } |
| 7130 | | 7058 | |
| 7131 | fn airAddSat(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7059 | fn airAddSat(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7132 | if (self.liveness.isUnused(inst)) return null; | | |
| 7133 | | | |
| 7134 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7060 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 7135 | const lhs = try self.resolveInst(bin_op.lhs); | 7061 | const lhs = try self.resolveInst(bin_op.lhs); |
| 7136 | const rhs = try self.resolveInst(bin_op.rhs); | 7062 | const rhs = try self.resolveInst(bin_op.rhs); |
| ... | @@ -7144,7 +7070,6 @@ pub const FuncGen = struct { | ... | @@ -7144,7 +7070,6 @@ pub const FuncGen = struct { |
| 7144 | } | 7070 | } |
| 7145 | | 7071 | |
| 7146 | fn airSub(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { | 7072 | fn airSub(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { |
| 7147 | if (self.liveness.isUnused(inst)) return null; | | |
| 7148 | self.builder.setFastMath(want_fast_math); | 7073 | self.builder.setFastMath(want_fast_math); |
| 7149 | | 7074 | |
| 7150 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7075 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| ... | @@ -7159,7 +7084,6 @@ pub const FuncGen = struct { | ... | @@ -7159,7 +7084,6 @@ pub const FuncGen = struct { |
| 7159 | } | 7084 | } |
| 7160 | | 7085 | |
| 7161 | fn airSubWrap(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { | 7086 | fn airSubWrap(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { |
| 7162 | if (self.liveness.isUnused(inst)) return null; | | |
| 7163 | self.builder.setFastMath(want_fast_math); | 7087 | self.builder.setFastMath(want_fast_math); |
| 7164 | | 7088 | |
| 7165 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7089 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| ... | @@ -7170,8 +7094,6 @@ pub const FuncGen = struct { | ... | @@ -7170,8 +7094,6 @@ pub const FuncGen = struct { |
| 7170 | } | 7094 | } |
| 7171 | | 7095 | |
| 7172 | fn airSubSat(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7096 | fn airSubSat(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7173 | if (self.liveness.isUnused(inst)) return null; | | |
| 7174 | | | |
| 7175 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7097 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 7176 | const lhs = try self.resolveInst(bin_op.lhs); | 7098 | const lhs = try self.resolveInst(bin_op.lhs); |
| 7177 | const rhs = try self.resolveInst(bin_op.rhs); | 7099 | const rhs = try self.resolveInst(bin_op.rhs); |
| ... | @@ -7184,7 +7106,6 @@ pub const FuncGen = struct { | ... | @@ -7184,7 +7106,6 @@ pub const FuncGen = struct { |
| 7184 | } | 7106 | } |
| 7185 | | 7107 | |
| 7186 | fn airMul(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { | 7108 | fn airMul(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { |
| 7187 | if (self.liveness.isUnused(inst)) return null; | | |
| 7188 | self.builder.setFastMath(want_fast_math); | 7109 | self.builder.setFastMath(want_fast_math); |
| 7189 | | 7110 | |
| 7190 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7111 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| ... | @@ -7199,7 +7120,6 @@ pub const FuncGen = struct { | ... | @@ -7199,7 +7120,6 @@ pub const FuncGen = struct { |
| 7199 | } | 7120 | } |
| 7200 | | 7121 | |
| 7201 | fn airMulWrap(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { | 7122 | fn airMulWrap(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { |
| 7202 | if (self.liveness.isUnused(inst)) return null; | | |
| 7203 | self.builder.setFastMath(want_fast_math); | 7123 | self.builder.setFastMath(want_fast_math); |
| 7204 | | 7124 | |
| 7205 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7125 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| ... | @@ -7210,8 +7130,6 @@ pub const FuncGen = struct { | ... | @@ -7210,8 +7130,6 @@ pub const FuncGen = struct { |
| 7210 | } | 7130 | } |
| 7211 | | 7131 | |
| 7212 | fn airMulSat(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7132 | fn airMulSat(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7213 | if (self.liveness.isUnused(inst)) return null; | | |
| 7214 | | | |
| 7215 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7133 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 7216 | const lhs = try self.resolveInst(bin_op.lhs); | 7134 | const lhs = try self.resolveInst(bin_op.lhs); |
| 7217 | const rhs = try self.resolveInst(bin_op.rhs); | 7135 | const rhs = try self.resolveInst(bin_op.rhs); |
| ... | @@ -7224,7 +7142,6 @@ pub const FuncGen = struct { | ... | @@ -7224,7 +7142,6 @@ pub const FuncGen = struct { |
| 7224 | } | 7142 | } |
| 7225 | | 7143 | |
| 7226 | fn airDivFloat(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { | 7144 | fn airDivFloat(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { |
| 7227 | if (self.liveness.isUnused(inst)) return null; | | |
| 7228 | self.builder.setFastMath(want_fast_math); | 7145 | self.builder.setFastMath(want_fast_math); |
| 7229 | | 7146 | |
| 7230 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7147 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| ... | @@ -7236,7 +7153,6 @@ pub const FuncGen = struct { | ... | @@ -7236,7 +7153,6 @@ pub const FuncGen = struct { |
| 7236 | } | 7153 | } |
| 7237 | | 7154 | |
| 7238 | fn airDivTrunc(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { | 7155 | fn airDivTrunc(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { |
| 7239 | if (self.liveness.isUnused(inst)) return null; | | |
| 7240 | self.builder.setFastMath(want_fast_math); | 7156 | self.builder.setFastMath(want_fast_math); |
| 7241 | | 7157 | |
| 7242 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7158 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| ... | @@ -7254,7 +7170,6 @@ pub const FuncGen = struct { | ... | @@ -7254,7 +7170,6 @@ pub const FuncGen = struct { |
| 7254 | } | 7170 | } |
| 7255 | | 7171 | |
| 7256 | fn airDivFloor(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { | 7172 | fn airDivFloor(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { |
| 7257 | if (self.liveness.isUnused(inst)) return null; | | |
| 7258 | self.builder.setFastMath(want_fast_math); | 7173 | self.builder.setFastMath(want_fast_math); |
| 7259 | | 7174 | |
| 7260 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7175 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| ... | @@ -7287,7 +7202,6 @@ pub const FuncGen = struct { | ... | @@ -7287,7 +7202,6 @@ pub const FuncGen = struct { |
| 7287 | } | 7202 | } |
| 7288 | | 7203 | |
| 7289 | fn airDivExact(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { | 7204 | fn airDivExact(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { |
| 7290 | if (self.liveness.isUnused(inst)) return null; | | |
| 7291 | self.builder.setFastMath(want_fast_math); | 7205 | self.builder.setFastMath(want_fast_math); |
| 7292 | | 7206 | |
| 7293 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7207 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| ... | @@ -7302,7 +7216,6 @@ pub const FuncGen = struct { | ... | @@ -7302,7 +7216,6 @@ pub const FuncGen = struct { |
| 7302 | } | 7216 | } |
| 7303 | | 7217 | |
| 7304 | fn airRem(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { | 7218 | fn airRem(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { |
| 7305 | if (self.liveness.isUnused(inst)) return null; | | |
| 7306 | self.builder.setFastMath(want_fast_math); | 7219 | self.builder.setFastMath(want_fast_math); |
| 7307 | | 7220 | |
| 7308 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7221 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| ... | @@ -7317,7 +7230,6 @@ pub const FuncGen = struct { | ... | @@ -7317,7 +7230,6 @@ pub const FuncGen = struct { |
| 7317 | } | 7230 | } |
| 7318 | | 7231 | |
| 7319 | fn airMod(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { | 7232 | fn airMod(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { |
| 7320 | if (self.liveness.isUnused(inst)) return null; | | |
| 7321 | self.builder.setFastMath(want_fast_math); | 7233 | self.builder.setFastMath(want_fast_math); |
| 7322 | | 7234 | |
| 7323 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7235 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| ... | @@ -7347,8 +7259,6 @@ pub const FuncGen = struct { | ... | @@ -7347,8 +7259,6 @@ pub const FuncGen = struct { |
| 7347 | } | 7259 | } |
| 7348 | | 7260 | |
| 7349 | fn airPtrAdd(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7261 | fn airPtrAdd(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7350 | if (self.liveness.isUnused(inst)) return null; | | |
| 7351 | | | |
| 7352 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | 7262 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 7353 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | 7263 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 7354 | const base_ptr = try self.resolveInst(bin_op.lhs); | 7264 | const base_ptr = try self.resolveInst(bin_op.lhs); |
| ... | @@ -7368,8 +7278,6 @@ pub const FuncGen = struct { | ... | @@ -7368,8 +7278,6 @@ pub const FuncGen = struct { |
| 7368 | } | 7278 | } |
| 7369 | | 7279 | |
| 7370 | fn airPtrSub(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7280 | fn airPtrSub(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7371 | if (self.liveness.isUnused(inst)) return null; | | |
| 7372 | | | |
| 7373 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | 7281 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 7374 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | 7282 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 7375 | const base_ptr = try self.resolveInst(bin_op.lhs); | 7283 | const base_ptr = try self.resolveInst(bin_op.lhs); |
| ... | @@ -7395,9 +7303,6 @@ pub const FuncGen = struct { | ... | @@ -7395,9 +7303,6 @@ pub const FuncGen = struct { |
| 7395 | signed_intrinsic: []const u8, | 7303 | signed_intrinsic: []const u8, |
| 7396 | unsigned_intrinsic: []const u8, | 7304 | unsigned_intrinsic: []const u8, |
| 7397 | ) !?*llvm.Value { | 7305 | ) !?*llvm.Value { |
| 7398 | if (self.liveness.isUnused(inst)) | | |
| 7399 | return null; | | |
| 7400 | | | |
| 7401 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | 7306 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 7402 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 7307 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 7403 | | 7308 | |
| ... | @@ -7686,8 +7591,6 @@ pub const FuncGen = struct { | ... | @@ -7686,8 +7591,6 @@ pub const FuncGen = struct { |
| 7686 | } | 7591 | } |
| 7687 | | 7592 | |
| 7688 | fn airMulAdd(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7593 | fn airMulAdd(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7689 | if (self.liveness.isUnused(inst)) return null; | | |
| 7690 | | | |
| 7691 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; | 7594 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; |
| 7692 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; | 7595 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; |
| 7693 | | 7596 | |
| ... | @@ -7700,9 +7603,6 @@ pub const FuncGen = struct { | ... | @@ -7700,9 +7603,6 @@ pub const FuncGen = struct { |
| 7700 | } | 7603 | } |
| 7701 | | 7604 | |
| 7702 | fn airShlWithOverflow(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7605 | fn airShlWithOverflow(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7703 | if (self.liveness.isUnused(inst)) | | |
| 7704 | return null; | | |
| 7705 | | | |
| 7706 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | 7606 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 7707 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 7607 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 7708 | | 7608 | |
| ... | @@ -7759,8 +7659,6 @@ pub const FuncGen = struct { | ... | @@ -7759,8 +7659,6 @@ pub const FuncGen = struct { |
| 7759 | } | 7659 | } |
| 7760 | | 7660 | |
| 7761 | fn airAnd(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7661 | fn airAnd(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7762 | if (self.liveness.isUnused(inst)) | | |
| 7763 | return null; | | |
| 7764 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7662 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 7765 | const lhs = try self.resolveInst(bin_op.lhs); | 7663 | const lhs = try self.resolveInst(bin_op.lhs); |
| 7766 | const rhs = try self.resolveInst(bin_op.rhs); | 7664 | const rhs = try self.resolveInst(bin_op.rhs); |
| ... | @@ -7768,8 +7666,6 @@ pub const FuncGen = struct { | ... | @@ -7768,8 +7666,6 @@ pub const FuncGen = struct { |
| 7768 | } | 7666 | } |
| 7769 | | 7667 | |
| 7770 | fn airOr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7668 | fn airOr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7771 | if (self.liveness.isUnused(inst)) | | |
| 7772 | return null; | | |
| 7773 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7669 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 7774 | const lhs = try self.resolveInst(bin_op.lhs); | 7670 | const lhs = try self.resolveInst(bin_op.lhs); |
| 7775 | const rhs = try self.resolveInst(bin_op.rhs); | 7671 | const rhs = try self.resolveInst(bin_op.rhs); |
| ... | @@ -7777,8 +7673,6 @@ pub const FuncGen = struct { | ... | @@ -7777,8 +7673,6 @@ pub const FuncGen = struct { |
| 7777 | } | 7673 | } |
| 7778 | | 7674 | |
| 7779 | fn airXor(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7675 | fn airXor(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7780 | if (self.liveness.isUnused(inst)) | | |
| 7781 | return null; | | |
| 7782 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7676 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 7783 | const lhs = try self.resolveInst(bin_op.lhs); | 7677 | const lhs = try self.resolveInst(bin_op.lhs); |
| 7784 | const rhs = try self.resolveInst(bin_op.rhs); | 7678 | const rhs = try self.resolveInst(bin_op.rhs); |
| ... | @@ -7786,8 +7680,6 @@ pub const FuncGen = struct { | ... | @@ -7786,8 +7680,6 @@ pub const FuncGen = struct { |
| 7786 | } | 7680 | } |
| 7787 | | 7681 | |
| 7788 | fn airShlExact(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7682 | fn airShlExact(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7789 | if (self.liveness.isUnused(inst)) return null; | | |
| 7790 | | | |
| 7791 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7683 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 7792 | | 7684 | |
| 7793 | const lhs = try self.resolveInst(bin_op.lhs); | 7685 | const lhs = try self.resolveInst(bin_op.lhs); |
| ... | @@ -7809,8 +7701,6 @@ pub const FuncGen = struct { | ... | @@ -7809,8 +7701,6 @@ pub const FuncGen = struct { |
| 7809 | } | 7701 | } |
| 7810 | | 7702 | |
| 7811 | fn airShl(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7703 | fn airShl(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7812 | if (self.liveness.isUnused(inst)) return null; | | |
| 7813 | | | |
| 7814 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7704 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 7815 | | 7705 | |
| 7816 | const lhs = try self.resolveInst(bin_op.lhs); | 7706 | const lhs = try self.resolveInst(bin_op.lhs); |
| ... | @@ -7831,8 +7721,6 @@ pub const FuncGen = struct { | ... | @@ -7831,8 +7721,6 @@ pub const FuncGen = struct { |
| 7831 | } | 7721 | } |
| 7832 | | 7722 | |
| 7833 | fn airShlSat(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7723 | fn airShlSat(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7834 | if (self.liveness.isUnused(inst)) return null; | | |
| 7835 | | | |
| 7836 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7724 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 7837 | | 7725 | |
| 7838 | const lhs = try self.resolveInst(bin_op.lhs); | 7726 | const lhs = try self.resolveInst(bin_op.lhs); |
| ... | @@ -7876,8 +7764,6 @@ pub const FuncGen = struct { | ... | @@ -7876,8 +7764,6 @@ pub const FuncGen = struct { |
| 7876 | } | 7764 | } |
| 7877 | | 7765 | |
| 7878 | fn airShr(self: *FuncGen, inst: Air.Inst.Index, is_exact: bool) !?*llvm.Value { | 7766 | fn airShr(self: *FuncGen, inst: Air.Inst.Index, is_exact: bool) !?*llvm.Value { |
| 7879 | if (self.liveness.isUnused(inst)) return null; | | |
| 7880 | | | |
| 7881 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; | 7767 | const bin_op = self.air.instructions.items(.data)[inst].bin_op; |
| 7882 | | 7768 | |
| 7883 | const lhs = try self.resolveInst(bin_op.lhs); | 7769 | const lhs = try self.resolveInst(bin_op.lhs); |
| ... | @@ -7912,9 +7798,6 @@ pub const FuncGen = struct { | ... | @@ -7912,9 +7798,6 @@ pub const FuncGen = struct { |
| 7912 | } | 7798 | } |
| 7913 | | 7799 | |
| 7914 | fn airIntCast(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7800 | fn airIntCast(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7915 | if (self.liveness.isUnused(inst)) | | |
| 7916 | return null; | | |
| 7917 | | | |
| 7918 | const target = self.dg.module.getTarget(); | 7801 | const target = self.dg.module.getTarget(); |
| 7919 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 7802 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 7920 | const dest_ty = self.air.typeOfIndex(inst); | 7803 | const dest_ty = self.air.typeOfIndex(inst); |
| ... | @@ -7937,8 +7820,6 @@ pub const FuncGen = struct { | ... | @@ -7937,8 +7820,6 @@ pub const FuncGen = struct { |
| 7937 | } | 7820 | } |
| 7938 | | 7821 | |
| 7939 | fn airTrunc(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7822 | fn airTrunc(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7940 | if (self.liveness.isUnused(inst)) return null; | | |
| 7941 | | | |
| 7942 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 7823 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 7943 | const operand = try self.resolveInst(ty_op.operand); | 7824 | const operand = try self.resolveInst(ty_op.operand); |
| 7944 | const dest_llvm_ty = try self.dg.lowerType(self.air.typeOfIndex(inst)); | 7825 | const dest_llvm_ty = try self.dg.lowerType(self.air.typeOfIndex(inst)); |
| ... | @@ -7946,9 +7827,6 @@ pub const FuncGen = struct { | ... | @@ -7946,9 +7827,6 @@ pub const FuncGen = struct { |
| 7946 | } | 7827 | } |
| 7947 | | 7828 | |
| 7948 | fn airFptrunc(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7829 | fn airFptrunc(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7949 | if (self.liveness.isUnused(inst)) | | |
| 7950 | return null; | | |
| 7951 | | | |
| 7952 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 7830 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 7953 | const operand = try self.resolveInst(ty_op.operand); | 7831 | const operand = try self.resolveInst(ty_op.operand); |
| 7954 | const operand_ty = self.air.typeOf(ty_op.operand); | 7832 | const operand_ty = self.air.typeOf(ty_op.operand); |
| ... | @@ -7978,9 +7856,6 @@ pub const FuncGen = struct { | ... | @@ -7978,9 +7856,6 @@ pub const FuncGen = struct { |
| 7978 | } | 7856 | } |
| 7979 | | 7857 | |
| 7980 | fn airFpext(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7858 | fn airFpext(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 7981 | if (self.liveness.isUnused(inst)) | | |
| 7982 | return null; | | |
| 7983 | | | |
| 7984 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 7859 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 7985 | const operand = try self.resolveInst(ty_op.operand); | 7860 | const operand = try self.resolveInst(ty_op.operand); |
| 7986 | const operand_ty = self.air.typeOf(ty_op.operand); | 7861 | const operand_ty = self.air.typeOf(ty_op.operand); |
| ... | @@ -8010,9 +7885,6 @@ pub const FuncGen = struct { | ... | @@ -8010,9 +7885,6 @@ pub const FuncGen = struct { |
| 8010 | } | 7885 | } |
| 8011 | | 7886 | |
| 8012 | fn airPtrToInt(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7887 | fn airPtrToInt(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 8013 | if (self.liveness.isUnused(inst)) | | |
| 8014 | return null; | | |
| 8015 | | | |
| 8016 | const un_op = self.air.instructions.items(.data)[inst].un_op; | 7888 | const un_op = self.air.instructions.items(.data)[inst].un_op; |
| 8017 | const operand = try self.resolveInst(un_op); | 7889 | const operand = try self.resolveInst(un_op); |
| 8018 | const dest_llvm_ty = try self.dg.lowerType(self.air.typeOfIndex(inst)); | 7890 | const dest_llvm_ty = try self.dg.lowerType(self.air.typeOfIndex(inst)); |
| ... | @@ -8020,8 +7892,6 @@ pub const FuncGen = struct { | ... | @@ -8020,8 +7892,6 @@ pub const FuncGen = struct { |
| 8020 | } | 7892 | } |
| 8021 | | 7893 | |
| 8022 | fn airBitCast(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 7894 | fn airBitCast(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 8023 | if (self.liveness.isUnused(inst)) return null; | | |
| 8024 | | | |
| 8025 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 7895 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 8026 | const operand_ty = self.air.typeOf(ty_op.operand); | 7896 | const operand_ty = self.air.typeOf(ty_op.operand); |
| 8027 | const inst_ty = self.air.typeOfIndex(inst); | 7897 | const inst_ty = self.air.typeOfIndex(inst); |
| ... | @@ -8137,9 +8007,6 @@ pub const FuncGen = struct { | ... | @@ -8137,9 +8007,6 @@ pub const FuncGen = struct { |
| 8137 | } | 8007 | } |
| 8138 | | 8008 | |
| 8139 | fn airBoolToInt(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 8009 | fn airBoolToInt(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 8140 | if (self.liveness.isUnused(inst)) | | |
| 8141 | return null; | | |
| 8142 | | | |
| 8143 | const un_op = self.air.instructions.items(.data)[inst].un_op; | 8010 | const un_op = self.air.instructions.items(.data)[inst].un_op; |
| 8144 | const operand = try self.resolveInst(un_op); | 8011 | const operand = try self.resolveInst(un_op); |
| 8145 | return operand; | 8012 | return operand; |
| ... | @@ -8189,7 +8056,6 @@ pub const FuncGen = struct { | ... | @@ -8189,7 +8056,6 @@ pub const FuncGen = struct { |
| 8189 | } | 8056 | } |
| 8190 | | 8057 | |
| 8191 | fn airAlloc(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 8058 | fn airAlloc(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 8192 | if (self.liveness.isUnused(inst)) return null; | | |
| 8193 | const ptr_ty = self.air.typeOfIndex(inst); | 8059 | const ptr_ty = self.air.typeOfIndex(inst); |
| 8194 | const pointee_type = ptr_ty.childType(); | 8060 | const pointee_type = ptr_ty.childType(); |
| 8195 | if (!pointee_type.isFnOrHasRuntimeBitsIgnoreComptime()) return self.dg.lowerPtrToVoid(ptr_ty); | 8061 | if (!pointee_type.isFnOrHasRuntimeBitsIgnoreComptime()) return self.dg.lowerPtrToVoid(ptr_ty); |
| ... | @@ -8201,7 +8067,6 @@ pub const FuncGen = struct { | ... | @@ -8201,7 +8067,6 @@ pub const FuncGen = struct { |
| 8201 | } | 8067 | } |
| 8202 | | 8068 | |
| 8203 | fn airRetPtr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 8069 | fn airRetPtr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 8204 | if (self.liveness.isUnused(inst)) return null; | | |
| 8205 | const ptr_ty = self.air.typeOfIndex(inst); | 8070 | const ptr_ty = self.air.typeOfIndex(inst); |
| 8206 | const ret_ty = ptr_ty.childType(); | 8071 | const ret_ty = ptr_ty.childType(); |
| 8207 | if (!ret_ty.isFnOrHasRuntimeBitsIgnoreComptime()) return self.dg.lowerPtrToVoid(ptr_ty); | 8072 | if (!ret_ty.isFnOrHasRuntimeBitsIgnoreComptime()) return self.dg.lowerPtrToVoid(ptr_ty); |
| ... | @@ -8289,8 +8154,6 @@ pub const FuncGen = struct { | ... | @@ -8289,8 +8154,6 @@ pub const FuncGen = struct { |
| 8289 | const ptr = try fg.resolveInst(ty_op.operand); | 8154 | const ptr = try fg.resolveInst(ty_op.operand); |
| 8290 | | 8155 | |
| 8291 | elide: { | 8156 | elide: { |
| 8292 | if (ptr_info.@"volatile") break :elide; | | |
| 8293 | if (fg.liveness.isUnused(inst)) return null; | | |
| 8294 | if (!isByRef(ptr_info.pointee_type)) break :elide; | 8157 | if (!isByRef(ptr_info.pointee_type)) break :elide; |
| 8295 | if (!canElideLoad(fg, body_tail)) break :elide; | 8158 | if (!canElideLoad(fg, body_tail)) break :elide; |
| 8296 | return ptr; | 8159 | return ptr; |
| ... | @@ -8314,8 +8177,7 @@ pub const FuncGen = struct { | ... | @@ -8314,8 +8177,7 @@ pub const FuncGen = struct { |
| 8314 | } | 8177 | } |
| 8315 | | 8178 | |
| 8316 | fn airRetAddr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 8179 | fn airRetAddr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 8317 | if (self.liveness.isUnused(inst)) return null; | 8180 | _ = inst; |
| 8318 | | | |
| 8319 | const llvm_usize = try self.dg.lowerType(Type.usize); | 8181 | const llvm_usize = try self.dg.lowerType(Type.usize); |
| 8320 | const target = self.dg.module.getTarget(); | 8182 | const target = self.dg.module.getTarget(); |
| 8321 | if (!target_util.supportsReturnAddress(target)) { | 8183 | if (!target_util.supportsReturnAddress(target)) { |
| ... | @@ -8331,8 +8193,7 @@ pub const FuncGen = struct { | ... | @@ -8331,8 +8193,7 @@ pub const FuncGen = struct { |
| 8331 | } | 8193 | } |
| 8332 | | 8194 | |
| 8333 | fn airFrameAddress(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 8195 | fn airFrameAddress(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 8334 | if (self.liveness.isUnused(inst)) return null; | 8196 | _ = inst; |
| 8335 | | | |
| 8336 | const llvm_i32 = self.context.intType(32); | 8197 | const llvm_i32 = self.context.intType(32); |
| 8337 | const llvm_fn_name = "llvm.frameaddress.p0"; | 8198 | const llvm_fn_name = "llvm.frameaddress.p0"; |
| 8338 | const llvm_fn = self.dg.object.llvm_module.getNamedFunction(llvm_fn_name) orelse blk: { | 8199 | const llvm_fn = self.dg.object.llvm_module.getNamedFunction(llvm_fn_name) orelse blk: { |
| ... | @@ -8462,8 +8323,6 @@ pub const FuncGen = struct { | ... | @@ -8462,8 +8323,6 @@ pub const FuncGen = struct { |
| 8462 | const ptr = try self.resolveInst(atomic_load.ptr); | 8323 | const ptr = try self.resolveInst(atomic_load.ptr); |
| 8463 | const ptr_ty = self.air.typeOf(atomic_load.ptr); | 8324 | const ptr_ty = self.air.typeOf(atomic_load.ptr); |
| 8464 | const ptr_info = ptr_ty.ptrInfo().data; | 8325 | const ptr_info = ptr_ty.ptrInfo().data; |
| 8465 | if (!ptr_info.@"volatile" and self.liveness.isUnused(inst)) | | |
| 8466 | return null; | | |
| 8467 | const elem_ty = ptr_info.pointee_type; | 8326 | const elem_ty = ptr_info.pointee_type; |
| 8468 | if (!elem_ty.hasRuntimeBitsIgnoreComptime()) | 8327 | if (!elem_ty.hasRuntimeBitsIgnoreComptime()) |
| 8469 | return null; | 8328 | return null; |
| ... | @@ -8577,8 +8436,6 @@ pub const FuncGen = struct { | ... | @@ -8577,8 +8436,6 @@ pub const FuncGen = struct { |
| 8577 | } | 8436 | } |
| 8578 | | 8437 | |
| 8579 | fn airGetUnionTag(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 8438 | fn airGetUnionTag(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 8580 | if (self.liveness.isUnused(inst)) return null; | | |
| 8581 | | | |
| 8582 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 8439 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 8583 | const un_ty = self.air.typeOf(ty_op.operand); | 8440 | const un_ty = self.air.typeOf(ty_op.operand); |
| 8584 | const target = self.dg.module.getTarget(); | 8441 | const target = self.dg.module.getTarget(); |
| ... | @@ -8603,8 +8460,6 @@ pub const FuncGen = struct { | ... | @@ -8603,8 +8460,6 @@ pub const FuncGen = struct { |
| 8603 | } | 8460 | } |
| 8604 | | 8461 | |
| 8605 | fn airUnaryOp(self: *FuncGen, inst: Air.Inst.Index, comptime op: FloatOp) !?*llvm.Value { | 8462 | fn airUnaryOp(self: *FuncGen, inst: Air.Inst.Index, comptime op: FloatOp) !?*llvm.Value { |
| 8606 | if (self.liveness.isUnused(inst)) return null; | | |
| 8607 | | | |
| 8608 | const un_op = self.air.instructions.items(.data)[inst].un_op; | 8463 | const un_op = self.air.instructions.items(.data)[inst].un_op; |
| 8609 | const operand = try self.resolveInst(un_op); | 8464 | const operand = try self.resolveInst(un_op); |
| 8610 | const operand_ty = self.air.typeOf(un_op); | 8465 | const operand_ty = self.air.typeOf(un_op); |
| ... | @@ -8613,7 +8468,6 @@ pub const FuncGen = struct { | ... | @@ -8613,7 +8468,6 @@ pub const FuncGen = struct { |
| 8613 | } | 8468 | } |
| 8614 | | 8469 | |
| 8615 | fn airNeg(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { | 8470 | fn airNeg(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { |
| 8616 | if (self.liveness.isUnused(inst)) return null; | | |
| 8617 | self.builder.setFastMath(want_fast_math); | 8471 | self.builder.setFastMath(want_fast_math); |
| 8618 | | 8472 | |
| 8619 | const un_op = self.air.instructions.items(.data)[inst].un_op; | 8473 | const un_op = self.air.instructions.items(.data)[inst].un_op; |
| ... | @@ -8624,8 +8478,6 @@ pub const FuncGen = struct { | ... | @@ -8624,8 +8478,6 @@ pub const FuncGen = struct { |
| 8624 | } | 8478 | } |
| 8625 | | 8479 | |
| 8626 | fn airClzCtz(self: *FuncGen, inst: Air.Inst.Index, llvm_fn_name: []const u8) !?*llvm.Value { | 8480 | fn airClzCtz(self: *FuncGen, inst: Air.Inst.Index, llvm_fn_name: []const u8) !?*llvm.Value { |
| 8627 | if (self.liveness.isUnused(inst)) return null; | | |
| 8628 | | | |
| 8629 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 8481 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 8630 | const operand_ty = self.air.typeOf(ty_op.operand); | 8482 | const operand_ty = self.air.typeOf(ty_op.operand); |
| 8631 | const operand = try self.resolveInst(ty_op.operand); | 8483 | const operand = try self.resolveInst(ty_op.operand); |
| ... | @@ -8652,8 +8504,6 @@ pub const FuncGen = struct { | ... | @@ -8652,8 +8504,6 @@ pub const FuncGen = struct { |
| 8652 | } | 8504 | } |
| 8653 | | 8505 | |
| 8654 | fn airBitOp(self: *FuncGen, inst: Air.Inst.Index, llvm_fn_name: []const u8) !?*llvm.Value { | 8506 | fn airBitOp(self: *FuncGen, inst: Air.Inst.Index, llvm_fn_name: []const u8) !?*llvm.Value { |
| 8655 | if (self.liveness.isUnused(inst)) return null; | | |
| 8656 | | | |
| 8657 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 8507 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 8658 | const operand_ty = self.air.typeOf(ty_op.operand); | 8508 | const operand_ty = self.air.typeOf(ty_op.operand); |
| 8659 | const operand = try self.resolveInst(ty_op.operand); | 8509 | const operand = try self.resolveInst(ty_op.operand); |
| ... | @@ -8679,8 +8529,6 @@ pub const FuncGen = struct { | ... | @@ -8679,8 +8529,6 @@ pub const FuncGen = struct { |
| 8679 | } | 8529 | } |
| 8680 | | 8530 | |
| 8681 | fn airByteSwap(self: *FuncGen, inst: Air.Inst.Index, llvm_fn_name: []const u8) !?*llvm.Value { | 8531 | fn airByteSwap(self: *FuncGen, inst: Air.Inst.Index, llvm_fn_name: []const u8) !?*llvm.Value { |
| 8682 | if (self.liveness.isUnused(inst)) return null; | | |
| 8683 | | | |
| 8684 | const target = self.dg.module.getTarget(); | 8532 | const target = self.dg.module.getTarget(); |
| 8685 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 8533 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 8686 | const operand_ty = self.air.typeOf(ty_op.operand); | 8534 | const operand_ty = self.air.typeOf(ty_op.operand); |
| ... | @@ -8734,8 +8582,6 @@ pub const FuncGen = struct { | ... | @@ -8734,8 +8582,6 @@ pub const FuncGen = struct { |
| 8734 | } | 8582 | } |
| 8735 | | 8583 | |
| 8736 | fn airErrorSetHasValue(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 8584 | fn airErrorSetHasValue(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 8737 | if (self.liveness.isUnused(inst)) return null; | | |
| 8738 | | | |
| 8739 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 8585 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 8740 | const operand = try self.resolveInst(ty_op.operand); | 8586 | const operand = try self.resolveInst(ty_op.operand); |
| 8741 | const error_set_ty = self.air.getRefType(ty_op.ty); | 8587 | const error_set_ty = self.air.getRefType(ty_op.ty); |
| ... | @@ -8781,8 +8627,6 @@ pub const FuncGen = struct { | ... | @@ -8781,8 +8627,6 @@ pub const FuncGen = struct { |
| 8781 | } | 8627 | } |
| 8782 | | 8628 | |
| 8783 | fn airIsNamedEnumValue(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 8629 | fn airIsNamedEnumValue(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 8784 | if (self.liveness.isUnused(inst)) return null; | | |
| 8785 | | | |
| 8786 | const un_op = self.air.instructions.items(.data)[inst].un_op; | 8630 | const un_op = self.air.instructions.items(.data)[inst].un_op; |
| 8787 | const operand = try self.resolveInst(un_op); | 8631 | const operand = try self.resolveInst(un_op); |
| 8788 | const enum_ty = self.air.typeOf(un_op); | 8632 | const enum_ty = self.air.typeOf(un_op); |
| ... | @@ -8862,8 +8706,6 @@ pub const FuncGen = struct { | ... | @@ -8862,8 +8706,6 @@ pub const FuncGen = struct { |
| 8862 | } | 8706 | } |
| 8863 | | 8707 | |
| 8864 | fn airTagName(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 8708 | fn airTagName(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 8865 | if (self.liveness.isUnused(inst)) return null; | | |
| 8866 | | | |
| 8867 | const un_op = self.air.instructions.items(.data)[inst].un_op; | 8709 | const un_op = self.air.instructions.items(.data)[inst].un_op; |
| 8868 | const operand = try self.resolveInst(un_op); | 8710 | const operand = try self.resolveInst(un_op); |
| 8869 | const enum_ty = self.air.typeOf(un_op); | 8711 | const enum_ty = self.air.typeOf(un_op); |
| ... | @@ -8995,8 +8837,6 @@ pub const FuncGen = struct { | ... | @@ -8995,8 +8837,6 @@ pub const FuncGen = struct { |
| 8995 | } | 8837 | } |
| 8996 | | 8838 | |
| 8997 | fn airErrorName(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 8839 | fn airErrorName(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 8998 | if (self.liveness.isUnused(inst)) return null; | | |
| 8999 | | | |
| 9000 | const un_op = self.air.instructions.items(.data)[inst].un_op; | 8840 | const un_op = self.air.instructions.items(.data)[inst].un_op; |
| 9001 | const operand = try self.resolveInst(un_op); | 8841 | const operand = try self.resolveInst(un_op); |
| 9002 | const slice_ty = self.air.typeOfIndex(inst); | 8842 | const slice_ty = self.air.typeOfIndex(inst); |
| ... | @@ -9011,8 +8851,6 @@ pub const FuncGen = struct { | ... | @@ -9011,8 +8851,6 @@ pub const FuncGen = struct { |
| 9011 | } | 8851 | } |
| 9012 | | 8852 | |
| 9013 | fn airSplat(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 8853 | fn airSplat(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 9014 | if (self.liveness.isUnused(inst)) return null; | | |
| 9015 | | | |
| 9016 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 8854 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 9017 | const scalar = try self.resolveInst(ty_op.operand); | 8855 | const scalar = try self.resolveInst(ty_op.operand); |
| 9018 | const vector_ty = self.air.typeOfIndex(inst); | 8856 | const vector_ty = self.air.typeOfIndex(inst); |
| ... | @@ -9021,8 +8859,6 @@ pub const FuncGen = struct { | ... | @@ -9021,8 +8859,6 @@ pub const FuncGen = struct { |
| 9021 | } | 8859 | } |
| 9022 | | 8860 | |
| 9023 | fn airSelect(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 8861 | fn airSelect(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 9024 | if (self.liveness.isUnused(inst)) return null; | | |
| 9025 | | | |
| 9026 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; | 8862 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; |
| 9027 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; | 8863 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; |
| 9028 | const pred = try self.resolveInst(pl_op.operand); | 8864 | const pred = try self.resolveInst(pl_op.operand); |
| ... | @@ -9033,8 +8869,6 @@ pub const FuncGen = struct { | ... | @@ -9033,8 +8869,6 @@ pub const FuncGen = struct { |
| 9033 | } | 8869 | } |
| 9034 | | 8870 | |
| 9035 | fn airShuffle(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 8871 | fn airShuffle(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 9036 | if (self.liveness.isUnused(inst)) return null; | | |
| 9037 | | | |
| 9038 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | 8872 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 9039 | const extra = self.air.extraData(Air.Shuffle, ty_pl.payload).data; | 8873 | const extra = self.air.extraData(Air.Shuffle, ty_pl.payload).data; |
| 9040 | const a = try self.resolveInst(extra.a); | 8874 | const a = try self.resolveInst(extra.a); |
| ... | @@ -9134,7 +8968,6 @@ pub const FuncGen = struct { | ... | @@ -9134,7 +8968,6 @@ pub const FuncGen = struct { |
| 9134 | } | 8968 | } |
| 9135 | | 8969 | |
| 9136 | fn airReduce(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { | 8970 | fn airReduce(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value { |
| 9137 | if (self.liveness.isUnused(inst)) return null; | | |
| 9138 | self.builder.setFastMath(want_fast_math); | 8971 | self.builder.setFastMath(want_fast_math); |
| 9139 | const target = self.dg.module.getTarget(); | 8972 | const target = self.dg.module.getTarget(); |
| 9140 | | 8973 | |
| ... | @@ -9221,8 +9054,6 @@ pub const FuncGen = struct { | ... | @@ -9221,8 +9054,6 @@ pub const FuncGen = struct { |
| 9221 | } | 9054 | } |
| 9222 | | 9055 | |
| 9223 | fn airAggregateInit(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 9056 | fn airAggregateInit(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 9224 | if (self.liveness.isUnused(inst)) return null; | | |
| 9225 | | | |
| 9226 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | 9057 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 9227 | const result_ty = self.air.typeOfIndex(inst); | 9058 | const result_ty = self.air.typeOfIndex(inst); |
| 9228 | const len = @intCast(usize, result_ty.arrayLen()); | 9059 | const len = @intCast(usize, result_ty.arrayLen()); |
| ... | @@ -9360,8 +9191,6 @@ pub const FuncGen = struct { | ... | @@ -9360,8 +9191,6 @@ pub const FuncGen = struct { |
| 9360 | } | 9191 | } |
| 9361 | | 9192 | |
| 9362 | fn airUnionInit(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 9193 | fn airUnionInit(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 9363 | if (self.liveness.isUnused(inst)) return null; | | |
| 9364 | | | |
| 9365 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; | 9194 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 9366 | const extra = self.air.extraData(Air.UnionInit, ty_pl.payload).data; | 9195 | const extra = self.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 9367 | const union_ty = self.air.typeOfIndex(inst); | 9196 | const union_ty = self.air.typeOfIndex(inst); |
| ... | @@ -9566,8 +9395,6 @@ pub const FuncGen = struct { | ... | @@ -9566,8 +9395,6 @@ pub const FuncGen = struct { |
| 9566 | } | 9395 | } |
| 9567 | | 9396 | |
| 9568 | fn airAddrSpaceCast(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 9397 | fn airAddrSpaceCast(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 9569 | if (self.liveness.isUnused(inst)) return null; | | |
| 9570 | | | |
| 9571 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 9398 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 9572 | const inst_ty = self.air.typeOfIndex(inst); | 9399 | const inst_ty = self.air.typeOfIndex(inst); |
| 9573 | const operand = try self.resolveInst(ty_op.operand); | 9400 | const operand = try self.resolveInst(ty_op.operand); |
| ... | @@ -9592,8 +9419,6 @@ pub const FuncGen = struct { | ... | @@ -9592,8 +9419,6 @@ pub const FuncGen = struct { |
| 9592 | } | 9419 | } |
| 9593 | | 9420 | |
| 9594 | fn airWorkItemId(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 9421 | fn airWorkItemId(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 9595 | if (self.liveness.isUnused(inst)) return null; | | |
| 9596 | | | |
| 9597 | const target = self.dg.module.getTarget(); | 9422 | const target = self.dg.module.getTarget(); |
| 9598 | assert(target.cpu.arch == .amdgcn); // TODO is to port this function to other GPU architectures | 9423 | assert(target.cpu.arch == .amdgcn); // TODO is to port this function to other GPU architectures |
| 9599 | | 9424 | |
| ... | @@ -9603,8 +9428,6 @@ pub const FuncGen = struct { | ... | @@ -9603,8 +9428,6 @@ pub const FuncGen = struct { |
| 9603 | } | 9428 | } |
| 9604 | | 9429 | |
| 9605 | fn airWorkGroupSize(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 9430 | fn airWorkGroupSize(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 9606 | if (self.liveness.isUnused(inst)) return null; | | |
| 9607 | | | |
| 9608 | const target = self.dg.module.getTarget(); | 9431 | const target = self.dg.module.getTarget(); |
| 9609 | assert(target.cpu.arch == .amdgcn); // TODO is to port this function to other GPU architectures | 9432 | assert(target.cpu.arch == .amdgcn); // TODO is to port this function to other GPU architectures |
| 9610 | | 9433 | |
| ... | @@ -9634,8 +9457,6 @@ pub const FuncGen = struct { | ... | @@ -9634,8 +9457,6 @@ pub const FuncGen = struct { |
| 9634 | } | 9457 | } |
| 9635 | | 9458 | |
| 9636 | fn airWorkGroupId(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 9459 | fn airWorkGroupId(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 9637 | if (self.liveness.isUnused(inst)) return null; | | |
| 9638 | | | |
| 9639 | const target = self.dg.module.getTarget(); | 9460 | const target = self.dg.module.getTarget(); |
| 9640 | assert(target.cpu.arch == .amdgcn); // TODO is to port this function to other GPU architectures | 9461 | assert(target.cpu.arch == .amdgcn); // TODO is to port this function to other GPU architectures |
| 9641 | | 9462 | |
| ... | @@ -9756,8 +9577,6 @@ pub const FuncGen = struct { | ... | @@ -9756,8 +9577,6 @@ pub const FuncGen = struct { |
| 9756 | struct_ptr_ty: Type, | 9577 | struct_ptr_ty: Type, |
| 9757 | field_index: u32, | 9578 | field_index: u32, |
| 9758 | ) !?*llvm.Value { | 9579 | ) !?*llvm.Value { |
| 9759 | if (self.liveness.isUnused(inst)) return null; | | |
| 9760 | | | |
| 9761 | const target = self.dg.object.target; | 9580 | const target = self.dg.object.target; |
| 9762 | const struct_ty = struct_ptr_ty.childType(); | 9581 | const struct_ty = struct_ptr_ty.childType(); |
| 9763 | switch (struct_ty.zigTypeTag()) { | 9582 | switch (struct_ty.zigTypeTag()) { |