| ... | ... | @@ -2450,6 +2450,12 @@ pub const FuncGen = struct { |
| 2450 | 2450 | const operand = try self.resolveInst(un_op); |
| 2451 | 2451 | const operand_ty = self.air.typeOf(un_op); |
| 2452 | 2452 | const optional_ty = if (operand_is_ptr) operand_ty.childType() else operand_ty; |
| 2453 | if (optional_ty.isPtrLikeOptional()) { |
| 2454 | const optional_llvm_ty = try self.dg.llvmType(optional_ty); |
| 2455 | const loaded = if (operand_is_ptr) self.builder.buildLoad(operand, "") else operand; |
| 2456 | return self.builder.buildICmp(pred, loaded, optional_llvm_ty.constNull(), ""); |
| 2457 | } |
| 2458 | |
| 2453 | 2459 | var buf: Type.Payload.ElemType = undefined; |
| 2454 | 2460 | const payload_ty = optional_ty.optionalChild(&buf); |
| 2455 | 2461 | if (!payload_ty.hasCodeGenBits()) { |
| ... | ... | @@ -2459,11 +2465,6 @@ pub const FuncGen = struct { |
| 2459 | 2465 | return operand; |
| 2460 | 2466 | } |
| 2461 | 2467 | } |
| 2462 | | if (optional_ty.isPtrLikeOptional()) { |
| 2463 | | const optional_llvm_ty = try self.dg.llvmType(optional_ty); |
| 2464 | | const loaded = if (operand_is_ptr) self.builder.buildLoad(operand, "") else operand; |
| 2465 | | return self.builder.buildICmp(pred, loaded, optional_llvm_ty.constNull(), ""); |
| 2466 | | } |
| 2467 | 2468 | |
| 2468 | 2469 | if (operand_is_ptr or isByRef(optional_ty)) { |
| 2469 | 2470 | const index_type = self.context.intType(32); |