diff options
| author | Robin Voetter <robin@voetter.nl> | 2023-09-17 14:01:11 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-09-23 12:36:56 -0700 |
| commit | 5141b4e05c08f394c4c0e76ea73f0547c9854288 (patch) | |
| tree | 1bea56ac716e6b973b0948fc0b5605a72708fbf0 /src/codegen | |
| parent | a86c939857f494a1d8f5749db1a10f008cd40ef3 (diff) | |
| download | zig-5141b4e05c08f394c4c0e76ea73f0547c9854288.tar.gz zig-5141b4e05c08f394c4c0e76ea73f0547c9854288.zip | |
spirv: fix store of undef
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/spirv.zig | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index 34ea55eaf3..572af60f3c 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -2753,20 +2753,12 @@ pub const DeclGen = struct { } fn airStore(self: *DeclGen, inst: Air.Inst.Index) !void { - const mod = self.module; const bin_op = self.air.instructions.items(.data)[inst].bin_op; const ptr_ty = self.typeOf(bin_op.lhs); const ptr = try self.resolve(bin_op.lhs); const value = try self.resolve(bin_op.rhs); - const ptr_ty_ref = try self.resolveType(ptr_ty, .direct); - const val_is_undef = if (try self.air.value(bin_op.rhs, mod)) |val| val.isUndefDeep(mod) else false; - if (val_is_undef) { - const undef = try self.spv.constUndef(ptr_ty_ref); - try self.store(ptr_ty, ptr, undef); - } else { - try self.store(ptr_ty, ptr, value); - } + try self.store(ptr_ty, ptr, value); } fn airLoop(self: *DeclGen, inst: Air.Inst.Index) !void { @@ -2790,6 +2782,7 @@ pub const DeclGen = struct { const operand_ty = self.typeOf(operand); const mod = self.module; if (operand_ty.hasRuntimeBits(mod)) { + // TODO: If we return an empty struct, this branch is also hit incorrectly. const operand_id = try self.resolve(operand); try self.func.body.emit(self.spv.gpa, .OpReturnValue, .{ .value = operand_id }); } else { |
