llvm.Builder: revert adding !nosanitize API

It's not actually useful after all.
This commit is contained in:
Andrew Kelley 2024-08-23 20:45:15 -07:00
parent e9a3ec7e1e
commit 0f824caa4c

View file

@ -3994,7 +3994,6 @@ pub const Function = struct {
names: [*]const String = &[0]String{}, names: [*]const String = &[0]String{},
value_indices: [*]const u32 = &[0]u32{}, value_indices: [*]const u32 = &[0]u32{},
strip: bool, strip: bool,
any_nosanitize: bool,
debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .{}, debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .{},
debug_values: []const Instruction.Index = &.{}, debug_values: []const Instruction.Index = &.{},
extra: []const u32 = &.{}, extra: []const u32 = &.{},
@ -4091,7 +4090,6 @@ pub const Function = struct {
block, block,
br, br,
br_cond, br_cond,
br_cond_nosanitize,
call, call,
@"call fast", @"call fast",
cmpxchg, cmpxchg,
@ -4347,13 +4345,6 @@ pub const Function = struct {
else => unreachable, else => unreachable,
}; };
} }
pub fn isNosanitize(self: Tag) bool {
return switch (self) {
.br_cond_nosanitize => true,
else => false,
};
}
}; };
pub const Index = enum(u32) { pub const Index = enum(u32) {
@ -4376,7 +4367,6 @@ pub const Function = struct {
return switch (wip.instructions.items(.tag)[@intFromEnum(self)]) { return switch (wip.instructions.items(.tag)[@intFromEnum(self)]) {
.br, .br,
.br_cond, .br_cond,
.br_cond_nosanitize,
.ret, .ret,
.@"ret void", .@"ret void",
.@"switch", .@"switch",
@ -4390,7 +4380,6 @@ pub const Function = struct {
return switch (wip.instructions.items(.tag)[@intFromEnum(self)]) { return switch (wip.instructions.items(.tag)[@intFromEnum(self)]) {
.br, .br,
.br_cond, .br_cond,
.br_cond_nosanitize,
.fence, .fence,
.ret, .ret,
.@"ret void", .@"ret void",
@ -4481,7 +4470,6 @@ pub const Function = struct {
.block => .label, .block => .label,
.br, .br,
.br_cond, .br_cond,
.br_cond_nosanitize,
.fence, .fence,
.ret, .ret,
.@"ret void", .@"ret void",
@ -4668,7 +4656,6 @@ pub const Function = struct {
.block => .label, .block => .label,
.br, .br,
.br_cond, .br_cond,
.br_cond_nosanitize,
.fence, .fence,
.ret, .ret,
.@"ret void", .@"ret void",
@ -5113,7 +5100,6 @@ pub const WipFunction = struct {
instructions: std.MultiArrayList(Instruction), instructions: std.MultiArrayList(Instruction),
names: std.ArrayListUnmanaged(String), names: std.ArrayListUnmanaged(String),
strip: bool, strip: bool,
any_nosanitize: bool,
debug_locations: std.AutoArrayHashMapUnmanaged(Instruction.Index, DebugLocation), debug_locations: std.AutoArrayHashMapUnmanaged(Instruction.Index, DebugLocation),
debug_values: std.AutoArrayHashMapUnmanaged(Instruction.Index, void), debug_values: std.AutoArrayHashMapUnmanaged(Instruction.Index, void),
extra: std.ArrayListUnmanaged(u32), extra: std.ArrayListUnmanaged(u32),
@ -5160,7 +5146,6 @@ pub const WipFunction = struct {
.instructions = .{}, .instructions = .{},
.names = .{}, .names = .{},
.strip = options.strip, .strip = options.strip,
.any_nosanitize = false,
.debug_locations = .{}, .debug_locations = .{},
.debug_values = .{}, .debug_values = .{},
.extra = .{}, .extra = .{},
@ -6452,7 +6437,7 @@ pub const WipFunction = struct {
.@"ret void", .@"ret void",
.@"unreachable", .@"unreachable",
=> {}, => {},
.br_cond, .br_cond_nosanitize => { .br_cond => {
const extra = self.extraData(Instruction.BrCond, instruction.data); const extra = self.extraData(Instruction.BrCond, instruction.data);
instruction.data = wip_extra.addExtra(Instruction.BrCond{ instruction.data = wip_extra.addExtra(Instruction.BrCond{
.cond = instructions.map(extra.cond), .cond = instructions.map(extra.cond),
@ -6639,7 +6624,6 @@ pub const WipFunction = struct {
function.names = names.ptr; function.names = names.ptr;
function.value_indices = value_indices.ptr; function.value_indices = value_indices.ptr;
function.strip = self.strip; function.strip = self.strip;
function.any_nosanitize = self.any_nosanitize;
function.debug_locations = debug_locations; function.debug_locations = debug_locations;
function.debug_values = debug_values; function.debug_values = debug_values;
} }
@ -8553,7 +8537,6 @@ pub fn init(options: Options) Allocator.Error!Builder {
try self.metadata_string_indices.append(self.gpa, 0); try self.metadata_string_indices.append(self.gpa, 0);
assert(try self.metadataString("") == .none); assert(try self.metadataString("") == .none);
assert(try self.debugTuple(&.{}) == .empty_tuple);
return self; return self;
} }
@ -8951,7 +8934,6 @@ pub fn addFunctionAssumeCapacity(
.kind = .{ .function = function_index }, .kind = .{ .function = function_index },
}), }),
.strip = undefined, .strip = undefined,
.any_nosanitize = false,
}); });
return function_index; return function_index;
} }
@ -9599,12 +9581,6 @@ pub fn printUnbuffered(
}); });
} }
if (function.instructions.len > 0) { if (function.instructions.len > 0) {
const maybe_empty_tuple: ?u32 = if (!function.any_nosanitize) null else b: {
const gop = try metadata_formatter.map.getOrPut(self.gpa, .{
.metadata = .empty_tuple,
});
break :b @intCast(gop.index);
};
var block_incoming_len: u32 = undefined; var block_incoming_len: u32 = undefined;
try writer.writeAll(" {\n"); try writer.writeAll(" {\n");
var maybe_dbg_index: ?u32 = null; var maybe_dbg_index: ?u32 = null;
@ -9794,14 +9770,6 @@ pub fn printUnbuffered(
}), }),
} }
}, },
.br_cond_nosanitize => {
const extra = function.extraData(Function.Instruction.BrCond, instruction.data);
try writer.print(" br {%}, {%}, {%}", .{
extra.cond.fmt(function_index, self),
extra.then.toInst(&function).fmt(function_index, self),
extra.@"else".toInst(&function).fmt(function_index, self),
});
},
.call, .call,
.@"call fast", .@"call fast",
.@"musttail call", .@"musttail call",
@ -10080,9 +10048,6 @@ pub fn printUnbuffered(
if (maybe_dbg_index) |dbg_index| { if (maybe_dbg_index) |dbg_index| {
try writer.print(", !dbg !{}", .{dbg_index}); try writer.print(", !dbg !{}", .{dbg_index});
} }
if (instruction.tag.isNosanitize()) {
try writer.print(", !nosanitize !{d}", .{maybe_empty_tuple.?});
}
try writer.writeByte('\n'); try writer.writeByte('\n');
} }
try writer.writeByte('}'); try writer.writeByte('}');