Commit c894df54f7

Jacob Young <jacobly0@users.noreply.github.com>
2024-02-23 01:44:34
Builder: fix debug location of the first instruction in a block
1 parent dbfa323
Changed files (1)
src
codegen
src/codegen/llvm/Builder.zig
@@ -6481,7 +6481,9 @@ pub const WipFunction = struct {
         self.instructions.appendAssumeCapacity(instruction);
         if (!self.builder.strip) {
             self.names.appendAssumeCapacity(final_name);
-            if (!std.meta.eql(self.current_debug_location, self.last_debug_location)) {
+            if (block_instructions.items.len == 0 or
+                self.current_debug_location != self.last_debug_location)
+            {
                 self.debug_locations.putAssumeCapacity(index, self.current_debug_location);
                 self.last_debug_location = self.current_debug_location;
             }