From 37a4d9391f9585759d4c0d274393a3ddb3e2e76b Mon Sep 17 00:00:00 2001 From: antlilja Date: Sun, 17 Mar 2024 16:23:14 +0100 Subject: LLVM: Fix reaching unreachable code when emitting fast call --- src/codegen/llvm/Builder.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/codegen/llvm') diff --git a/src/codegen/llvm/Builder.zig b/src/codegen/llvm/Builder.zig index c885261a24..d98afb3389 100644 --- a/src/codegen/llvm/Builder.zig +++ b/src/codegen/llvm/Builder.zig @@ -14721,10 +14721,10 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co try function_block.writeAbbrevAdapted(FunctionBlock.CallFast{ .attributes = extra.data.attributes, .call_type = switch (kind) { - .call => .{ .call_conv = call_conv }, - .@"tail call" => .{ .tail = true, .call_conv = call_conv }, - .@"musttail call" => .{ .must_tail = true, .call_conv = call_conv }, - .@"notail call" => .{ .no_tail = true, .call_conv = call_conv }, + .@"call fast" => .{ .call_conv = call_conv }, + .@"tail call fast" => .{ .tail = true, .call_conv = call_conv }, + .@"musttail call fast" => .{ .must_tail = true, .call_conv = call_conv }, + .@"notail call fast" => .{ .no_tail = true, .call_conv = call_conv }, else => unreachable, }, .fast_math = .{}, -- cgit v1.2.3 From b20cee586c6bd1cbc0c5364e8ebe5ae7ecf0ca1f Mon Sep 17 00:00:00 2001 From: antlilja Date: Sun, 17 Mar 2024 16:25:59 +0100 Subject: LLVM: Fix incorrect fast constant in FastMath packed struct --- src/codegen/llvm/Builder.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/codegen/llvm') diff --git a/src/codegen/llvm/Builder.zig b/src/codegen/llvm/Builder.zig index d98afb3389..f8ed5dc751 100644 --- a/src/codegen/llvm/Builder.zig +++ b/src/codegen/llvm/Builder.zig @@ -6839,7 +6839,7 @@ pub const FastMath = packed struct(u8) { .arcp = true, .contract = true, .afn = true, - .realloc = true, + .reassoc = true, }; }; -- cgit v1.2.3 From 79b868d504f2b9c583a84c784a2f6197ac91bc25 Mon Sep 17 00:00:00 2001 From: antlilja Date: Sun, 17 Mar 2024 16:26:28 +0100 Subject: LLVM: Use fast math when requested --- src/codegen/llvm/Builder.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/codegen/llvm') diff --git a/src/codegen/llvm/Builder.zig b/src/codegen/llvm/Builder.zig index f8ed5dc751..12ecd2ec38 100644 --- a/src/codegen/llvm/Builder.zig +++ b/src/codegen/llvm/Builder.zig @@ -14727,7 +14727,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co .@"notail call fast" => .{ .no_tail = true, .call_conv = call_conv }, else => unreachable, }, - .fast_math = .{}, + .fast_math = FastMath.fast, .type_id = extra.data.ty, .callee = extra.data.callee, .args = args, @@ -14786,7 +14786,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co .opcode = kind.toBinaryOpcode(), .lhs = adapter.getOffsetValueIndex(extra.lhs), .rhs = adapter.getOffsetValueIndex(extra.rhs), - .fast_math = .{}, + .fast_math = FastMath.fast, }); }, .alloca, @@ -14884,7 +14884,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co .lhs = adapter.getOffsetValueIndex(extra.lhs), .rhs = adapter.getOffsetValueIndex(extra.rhs), .pred = kind.toCmpPredicate(), - .fast_math = .{}, + .fast_math = FastMath.fast, }); }, .fneg => try function_block.writeAbbrev(FunctionBlock.FNeg{ @@ -14892,7 +14892,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co }), .@"fneg fast" => try function_block.writeAbbrev(FunctionBlock.FNegFast{ .val = adapter.getOffsetValueIndex(@enumFromInt(datas[instr_index])), - .fast_math = .{}, + .fast_math = FastMath.fast, }), .extractvalue => { var extra = func.extraDataTrail(Function.Instruction.ExtractValue, datas[instr_index]); @@ -14940,7 +14940,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co .lhs = adapter.getOffsetValueIndex(extra.lhs), .rhs = adapter.getOffsetValueIndex(extra.rhs), .cond = adapter.getOffsetValueIndex(extra.cond), - .fast_math = .{}, + .fast_math = FastMath.fast, }); }, .shufflevector => { -- cgit v1.2.3