Commit 94af47d28c

Ali Cheraghi <alichraghi@proton.me>
2025-02-24 00:08:07
spirv: do not generate unnecessary forward pointer
Co-authored-by: Robin Voetter <robin@voetter.nl>
1 parent 181a89e
Changed files (2)
src
codegen
link
src/codegen/spirv.zig
@@ -1300,6 +1300,8 @@ const NavGen = struct {
             .type = child_ty_id,
         });
 
+        self.ptr_types.getPtr(key).?.fwd_emitted = true;
+
         return result_id;
     }
 
src/link/SpirV/prune_unused.zig
@@ -39,6 +39,7 @@ fn canPrune(op: Opcode) bool {
         .Arithmetic,
         .RelationalAndLogical,
         .Bit,
+        .Annotation,
         => true,
         else => switch (op) {
             .OpFunction,
@@ -273,7 +274,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule, progress: std.Pr
         .alive = try std.DynamicBitSetUnmanaged.initEmpty(a, info.result_id_to_code_offset.count()),
     };
 
-    // Mark initial stuff as slive
+    // Mark initial stuff as alive
     {
         var it = binary.iterateInstructions();
         while (it.next()) |inst| {