authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-08-23 20:45:15-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-08-27 15:09:11-07:00
log0f824caa4cc0e16a8529318a5bb7e84795367002
tree5894cf5c5e1f389ed870bdff3781491410e2d7f7
parente9a3ec7e1e0536dcc833acff3cb8745b6e8df848

llvm.Builder: revert adding !nosanitize API

It's not actually useful after all.

1 files changed, 1 insertions(+), 36 deletions(-)

src/codegen/llvm/Builder.zig+1-36
...@@ -3994,7 +3994,6 @@ pub const Function = struct {...@@ -3994,7 +3994,6 @@ pub const Function = struct {
3994 names: [*]const String = &[0]String{},3994 names: [*]const String = &[0]String{},
3995 value_indices: [*]const u32 = &[0]u32{},3995 value_indices: [*]const u32 = &[0]u32{},
3996 strip: bool,3996 strip: bool,
3997 any_nosanitize: bool,
3998 debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .{},3997 debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .{},
3999 debug_values: []const Instruction.Index = &.{},3998 debug_values: []const Instruction.Index = &.{},
4000 extra: []const u32 = &.{},3999 extra: []const u32 = &.{},
...@@ -4091,7 +4090,6 @@ pub const Function = struct {...@@ -4091,7 +4090,6 @@ pub const Function = struct {
4091 block,4090 block,
4092 br,4091 br,
4093 br_cond,4092 br_cond,
4094 br_cond_nosanitize,
4095 call,4093 call,
4096 @"call fast",4094 @"call fast",
4097 cmpxchg,4095 cmpxchg,
...@@ -4347,13 +4345,6 @@ pub const Function = struct {...@@ -4347,13 +4345,6 @@ pub const Function = struct {
4347 else => unreachable,4345 else => unreachable,
4348 };4346 };
4349 }4347 }
4350
4351 pub fn isNosanitize(self: Tag) bool {
4352 return switch (self) {
4353 .br_cond_nosanitize => true,
4354 else => false,
4355 };
4356 }
4357 };4348 };
43584349
4359 pub const Index = enum(u32) {4350 pub const Index = enum(u32) {
...@@ -4376,7 +4367,6 @@ pub const Function = struct {...@@ -4376,7 +4367,6 @@ pub const Function = struct {
4376 return switch (wip.instructions.items(.tag)[@intFromEnum(self)]) {4367 return switch (wip.instructions.items(.tag)[@intFromEnum(self)]) {
4377 .br,4368 .br,
4378 .br_cond,4369 .br_cond,
4379 .br_cond_nosanitize,
4380 .ret,4370 .ret,
4381 .@"ret void",4371 .@"ret void",
4382 .@"switch",4372 .@"switch",
...@@ -4390,7 +4380,6 @@ pub const Function = struct {...@@ -4390,7 +4380,6 @@ pub const Function = struct {
4390 return switch (wip.instructions.items(.tag)[@intFromEnum(self)]) {4380 return switch (wip.instructions.items(.tag)[@intFromEnum(self)]) {
4391 .br,4381 .br,
4392 .br_cond,4382 .br_cond,
4393 .br_cond_nosanitize,
4394 .fence,4383 .fence,
4395 .ret,4384 .ret,
4396 .@"ret void",4385 .@"ret void",
...@@ -4481,7 +4470,6 @@ pub const Function = struct {...@@ -4481,7 +4470,6 @@ pub const Function = struct {
4481 .block => .label,4470 .block => .label,
4482 .br,4471 .br,
4483 .br_cond,4472 .br_cond,
4484 .br_cond_nosanitize,
4485 .fence,4473 .fence,
4486 .ret,4474 .ret,
4487 .@"ret void",4475 .@"ret void",
...@@ -4668,7 +4656,6 @@ pub const Function = struct {...@@ -4668,7 +4656,6 @@ pub const Function = struct {
4668 .block => .label,4656 .block => .label,
4669 .br,4657 .br,
4670 .br_cond,4658 .br_cond,
4671 .br_cond_nosanitize,
4672 .fence,4659 .fence,
4673 .ret,4660 .ret,
4674 .@"ret void",4661 .@"ret void",
...@@ -5113,7 +5100,6 @@ pub const WipFunction = struct {...@@ -5113,7 +5100,6 @@ pub const WipFunction = struct {
5113 instructions: std.MultiArrayList(Instruction),5100 instructions: std.MultiArrayList(Instruction),
5114 names: std.ArrayListUnmanaged(String),5101 names: std.ArrayListUnmanaged(String),
5115 strip: bool,5102 strip: bool,
5116 any_nosanitize: bool,
5117 debug_locations: std.AutoArrayHashMapUnmanaged(Instruction.Index, DebugLocation),5103 debug_locations: std.AutoArrayHashMapUnmanaged(Instruction.Index, DebugLocation),
5118 debug_values: std.AutoArrayHashMapUnmanaged(Instruction.Index, void),5104 debug_values: std.AutoArrayHashMapUnmanaged(Instruction.Index, void),
5119 extra: std.ArrayListUnmanaged(u32),5105 extra: std.ArrayListUnmanaged(u32),
...@@ -5160,7 +5146,6 @@ pub const WipFunction = struct {...@@ -5160,7 +5146,6 @@ pub const WipFunction = struct {
5160 .instructions = .{},5146 .instructions = .{},
5161 .names = .{},5147 .names = .{},
5162 .strip = options.strip,5148 .strip = options.strip,
5163 .any_nosanitize = false,
5164 .debug_locations = .{},5149 .debug_locations = .{},
5165 .debug_values = .{},5150 .debug_values = .{},
5166 .extra = .{},5151 .extra = .{},
...@@ -6452,7 +6437,7 @@ pub const WipFunction = struct {...@@ -6452,7 +6437,7 @@ pub const WipFunction = struct {
6452 .@"ret void",6437 .@"ret void",
6453 .@"unreachable",6438 .@"unreachable",
6454 => {},6439 => {},
6455 .br_cond, .br_cond_nosanitize => {6440 .br_cond => {
6456 const extra = self.extraData(Instruction.BrCond, instruction.data);6441 const extra = self.extraData(Instruction.BrCond, instruction.data);
6457 instruction.data = wip_extra.addExtra(Instruction.BrCond{6442 instruction.data = wip_extra.addExtra(Instruction.BrCond{
6458 .cond = instructions.map(extra.cond),6443 .cond = instructions.map(extra.cond),
...@@ -6639,7 +6624,6 @@ pub const WipFunction = struct {...@@ -6639,7 +6624,6 @@ pub const WipFunction = struct {
6639 function.names = names.ptr;6624 function.names = names.ptr;
6640 function.value_indices = value_indices.ptr;6625 function.value_indices = value_indices.ptr;
6641 function.strip = self.strip;6626 function.strip = self.strip;
6642 function.any_nosanitize = self.any_nosanitize;
6643 function.debug_locations = debug_locations;6627 function.debug_locations = debug_locations;
6644 function.debug_values = debug_values;6628 function.debug_values = debug_values;
6645 }6629 }
...@@ -8553,7 +8537,6 @@ pub fn init(options: Options) Allocator.Error!Builder {...@@ -8553,7 +8537,6 @@ pub fn init(options: Options) Allocator.Error!Builder {
85538537
8554 try self.metadata_string_indices.append(self.gpa, 0);8538 try self.metadata_string_indices.append(self.gpa, 0);
8555 assert(try self.metadataString("") == .none);8539 assert(try self.metadataString("") == .none);
8556 assert(try self.debugTuple(&.{}) == .empty_tuple);
85578540
8558 return self;8541 return self;
8559}8542}
...@@ -8951,7 +8934,6 @@ pub fn addFunctionAssumeCapacity(...@@ -8951,7 +8934,6 @@ pub fn addFunctionAssumeCapacity(
8951 .kind = .{ .function = function_index },8934 .kind = .{ .function = function_index },
8952 }),8935 }),
8953 .strip = undefined,8936 .strip = undefined,
8954 .any_nosanitize = false,
8955 });8937 });
8956 return function_index;8938 return function_index;
8957}8939}
...@@ -9599,12 +9581,6 @@ pub fn printUnbuffered(...@@ -9599,12 +9581,6 @@ pub fn printUnbuffered(
9599 });9581 });
9600 }9582 }
9601 if (function.instructions.len > 0) {9583 if (function.instructions.len > 0) {
9602 const maybe_empty_tuple: ?u32 = if (!function.any_nosanitize) null else b: {
9603 const gop = try metadata_formatter.map.getOrPut(self.gpa, .{
9604 .metadata = .empty_tuple,
9605 });
9606 break :b @intCast(gop.index);
9607 };
9608 var block_incoming_len: u32 = undefined;9584 var block_incoming_len: u32 = undefined;
9609 try writer.writeAll(" {\n");9585 try writer.writeAll(" {\n");
9610 var maybe_dbg_index: ?u32 = null;9586 var maybe_dbg_index: ?u32 = null;
...@@ -9794,14 +9770,6 @@ pub fn printUnbuffered(...@@ -9794,14 +9770,6 @@ pub fn printUnbuffered(
9794 }),9770 }),
9795 }9771 }
9796 },9772 },
9797 .br_cond_nosanitize => {
9798 const extra = function.extraData(Function.Instruction.BrCond, instruction.data);
9799 try writer.print(" br {%}, {%}, {%}", .{
9800 extra.cond.fmt(function_index, self),
9801 extra.then.toInst(&function).fmt(function_index, self),
9802 extra.@"else".toInst(&function).fmt(function_index, self),
9803 });
9804 },
9805 .call,9773 .call,
9806 .@"call fast",9774 .@"call fast",
9807 .@"musttail call",9775 .@"musttail call",
...@@ -10080,9 +10048,6 @@ pub fn printUnbuffered(...@@ -10080,9 +10048,6 @@ pub fn printUnbuffered(
10080 if (maybe_dbg_index) |dbg_index| {10048 if (maybe_dbg_index) |dbg_index| {
10081 try writer.print(", !dbg !{}", .{dbg_index});10049 try writer.print(", !dbg !{}", .{dbg_index});
10082 }10050 }
10083 if (instruction.tag.isNosanitize()) {
10084 try writer.print(", !nosanitize !{d}", .{maybe_empty_tuple.?});
10085 }
10086 try writer.writeByte('\n');10051 try writer.writeByte('\n');
10087 }10052 }
10088 try writer.writeByte('}');10053 try writer.writeByte('}');