authorgravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2025-02-24 02:38:07+03:30
committergravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2025-02-24 19:12:38+01:00
log94af47d28c83efa3dc26ee0b47b224b823c9b333
treefa1cc35a793d91716709b4e1e4859c81c7015ba4
parent181a89e728a89495c00b09b767f579c9591cb08c
signaturebadge-check Signed by SSH key SHA256:ZS52FNyUv2WUXvO4njmVaFVO46RHojFuOrxRc4LuKzg

spirv: do not generate unnecessary forward pointer

Co-authored-by: Robin Voetter <robin@voetter.nl>

2 files changed, 4 insertions(+), 1 deletions(-)

src/codegen/spirv.zig+2
...@@ -1300,6 +1300,8 @@ const NavGen = struct {...@@ -1300,6 +1300,8 @@ const NavGen = struct {
1300 .type = child_ty_id,1300 .type = child_ty_id,
1301 });1301 });
13021302
1303 self.ptr_types.getPtr(key).?.fwd_emitted = true;
1304
1303 return result_id;1305 return result_id;
1304 }1306 }
13051307
src/link/SpirV/prune_unused.zig+2-1
...@@ -39,6 +39,7 @@ fn canPrune(op: Opcode) bool {...@@ -39,6 +39,7 @@ fn canPrune(op: Opcode) bool {
39 .Arithmetic,39 .Arithmetic,
40 .RelationalAndLogical,40 .RelationalAndLogical,
41 .Bit,41 .Bit,
42 .Annotation,
42 => true,43 => true,
43 else => switch (op) {44 else => switch (op) {
44 .OpFunction,45 .OpFunction,
...@@ -273,7 +274,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule, progress: std.Pr...@@ -273,7 +274,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule, progress: std.Pr
273 .alive = try std.DynamicBitSetUnmanaged.initEmpty(a, info.result_id_to_code_offset.count()),274 .alive = try std.DynamicBitSetUnmanaged.initEmpty(a, info.result_id_to_code_offset.count()),
274 };275 };
275276
276 // Mark initial stuff as slive277 // Mark initial stuff as alive
277 {278 {
278 var it = binary.iterateInstructions();279 var it = binary.iterateInstructions();
279 while (it.next()) |inst| {280 while (it.next()) |inst| {