authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2025-07-19 18:26:56-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-07-20 06:42:47+02:00
logb4fd57a9c114748afb9ba0a04bede61089a02ddf
treec0ac9718552c8449de0c88790f3d8278e7982be2
parent592f1043dc704faf79bde7149917d4155b3747f8

llvm: workaround crashes in llvm loop optimizations

Workaround for #24383

1 files changed, 3 insertions(+), 0 deletions(-)

src/codegen/llvm.zig+3
...@@ -6385,6 +6385,9 @@ pub const FuncGen = struct {...@@ -6385,6 +6385,9 @@ pub const FuncGen = struct {
6385 // * https://github.com/llvm/llvm-project/blob/56905dab7da50bccfcceaeb496b206ff476127e1/llvm/test/MC/WebAssembly/blockaddress.ll6385 // * https://github.com/llvm/llvm-project/blob/56905dab7da50bccfcceaeb496b206ff476127e1/llvm/test/MC/WebAssembly/blockaddress.ll
6386 if (zcu.comp.getTarget().cpu.arch.isWasm()) break :jmp_table null;6386 if (zcu.comp.getTarget().cpu.arch.isWasm()) break :jmp_table null;
63876387
6388 // Workaround for https://github.com/ziglang/zig/issues/24383:
6389 if (self.ng.ownerModule().optimize_mode == .ReleaseSafe) break :jmp_table null;
6390
6388 // On a 64-bit target, 1024 pointers in our jump table is about 8K of pointers. This seems just6391 // On a 64-bit target, 1024 pointers in our jump table is about 8K of pointers. This seems just
6389 // about acceptable - it won't fill L1d cache on most CPUs.6392 // about acceptable - it won't fill L1d cache on most CPUs.
6390 const max_table_len = 1024;6393 const max_table_len = 1024;