| ... | @@ -5346,7 +5346,8 @@ pub const FuncGen = struct { | ... | @@ -5346,7 +5346,8 @@ pub const FuncGen = struct { |
| 5346 | const err_union_ty = self.air.typeOf(pl_op.operand); | 5346 | const err_union_ty = self.air.typeOf(pl_op.operand); |
| 5347 | const payload_ty = self.air.typeOfIndex(inst); | 5347 | const payload_ty = self.air.typeOfIndex(inst); |
| 5348 | const can_elide_load = if (isByRef(payload_ty)) self.canElideLoad(body_tail) else false; | 5348 | const can_elide_load = if (isByRef(payload_ty)) self.canElideLoad(body_tail) else false; |
| 5349 | return lowerTry(self, err_union, body, err_union_ty, false, can_elide_load, payload_ty); | 5349 | const is_unused = self.liveness.isUnused(inst); |
| | 5350 | return lowerTry(self, err_union, body, err_union_ty, false, can_elide_load, is_unused, payload_ty); |
| 5350 | } | 5351 | } |
| 5351 | | 5352 | |
| 5352 | fn airTryPtr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 5353 | fn airTryPtr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| ... | @@ -5356,7 +5357,8 @@ pub const FuncGen = struct { | ... | @@ -5356,7 +5357,8 @@ pub const FuncGen = struct { |
| 5356 | const body = self.air.extra[extra.end..][0..extra.data.body_len]; | 5357 | const body = self.air.extra[extra.end..][0..extra.data.body_len]; |
| 5357 | const err_union_ty = self.air.typeOf(extra.data.ptr).childType(); | 5358 | const err_union_ty = self.air.typeOf(extra.data.ptr).childType(); |
| 5358 | const payload_ty = self.air.typeOfIndex(inst); | 5359 | const payload_ty = self.air.typeOfIndex(inst); |
| 5359 | return lowerTry(self, err_union_ptr, body, err_union_ty, true, true, payload_ty); | 5360 | const is_unused = self.liveness.isUnused(inst); |
| | 5361 | return lowerTry(self, err_union_ptr, body, err_union_ty, true, true, is_unused, payload_ty); |
| 5360 | } | 5362 | } |
| 5361 | | 5363 | |
| 5362 | fn lowerTry( | 5364 | fn lowerTry( |
| ... | @@ -5366,6 +5368,7 @@ pub const FuncGen = struct { | ... | @@ -5366,6 +5368,7 @@ pub const FuncGen = struct { |
| 5366 | err_union_ty: Type, | 5368 | err_union_ty: Type, |
| 5367 | operand_is_ptr: bool, | 5369 | operand_is_ptr: bool, |
| 5368 | can_elide_load: bool, | 5370 | can_elide_load: bool, |
| | 5371 | is_unused: bool, |
| 5369 | result_ty: Type, | 5372 | result_ty: Type, |
| 5370 | ) !?*llvm.Value { | 5373 | ) !?*llvm.Value { |
| 5371 | const payload_ty = err_union_ty.errorUnionPayload(); | 5374 | const payload_ty = err_union_ty.errorUnionPayload(); |
| ... | @@ -5405,6 +5408,9 @@ pub const FuncGen = struct { | ... | @@ -5405,6 +5408,9 @@ pub const FuncGen = struct { |
| 5405 | | 5408 | |
| 5406 | fg.builder.positionBuilderAtEnd(continue_block); | 5409 | fg.builder.positionBuilderAtEnd(continue_block); |
| 5407 | } | 5410 | } |
| | 5411 | if (is_unused) { |
| | 5412 | return null; |
| | 5413 | } |
| 5408 | if (!payload_has_bits) { | 5414 | if (!payload_has_bits) { |
| 5409 | if (!operand_is_ptr) return null; | 5415 | if (!operand_is_ptr) return null; |
| 5410 | | 5416 | |