From c894df54f75f8004348834fce21df1f0684536cc Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Fri, 23 Feb 2024 01:44:34 +0100 Subject: [PATCH] Builder: fix debug location of the first instruction in a block --- src/codegen/llvm/Builder.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/codegen/llvm/Builder.zig b/src/codegen/llvm/Builder.zig index 428330dc99..86fa735aca 100644 --- a/src/codegen/llvm/Builder.zig +++ b/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; }