Commit 5a8acc9115

xdBronch <51252236+xdBronch@users.noreply.github.com>
2025-07-10 15:16:54
fix some llvm ir printer bugs
1 parent e8a4e47
Changed files (1)
lib
std
zig
lib/std/zig/llvm/Builder.zig
@@ -2037,7 +2037,7 @@ pub const Alignment = enum(u6) {
 
         pub fn format(p: Prefixed, w: *Writer) Writer.Error!void {
             const byte_units = p.alignment.toByteUnits() orelse return;
-            return w.print("{s}align ({d})", .{ p.prefix, byte_units });
+            return w.print("{s}align {d}", .{ p.prefix, byte_units });
         }
     };
 
@@ -2384,7 +2384,7 @@ pub const Global = struct {
         };
         fn format(data: FormatData, w: *Writer) Writer.Error!void {
             try w.print("@{f}", .{
-                data.global.unwrap(data.builder).name(data.builder).fmt(data.builder, null),
+                data.global.unwrap(data.builder).name(data.builder).fmt(data.builder, .quote_unless_valid_identifier),
             });
         }
         pub fn fmt(self: Index, builder: *const Builder) std.fmt.Formatter(FormatData, format) {
@@ -8401,7 +8401,7 @@ pub const Metadata = enum(u32) {
                     }, w);
                 },
                 .string => |node| try w.print("{s}{f}", .{
-                    @as([]const u8, if (is_specialized) "" else "!"), node.fmt(builder),
+                    @as([]const u8, if (is_specialized) "!" else ""), node.fmt(builder),
                 }),
                 inline .bool, .u32, .u64 => |node| try w.print("{}", .{node}),
                 inline .di_flags, .sp_flags => |node| try w.print("{f}", .{node}),
@@ -9782,7 +9782,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void
                             instruction_index.name(&function).fmt(self),
                             @tagName(tag),
                             extra.lhs.fmt(function_index, self, .{ .percent = true }),
-                            extra.rhs.fmt(function_index, self, .{ .percent = true }),
+                            extra.rhs.fmt(function_index, self, .{}),
                         });
                     },
                     .addrspacecast,