authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-09-10 05:00:02+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-09-10 16:09:43-07:00
log2fc1f9b9716f8561c94ecdeb8196ac4ce582f318
tree6c248ab72b0db39ad3174ef8f889623b02ca5550
parent36b89101df52121ffbdc08d6a77b939d05821080

llvm: Don't use the optimized jump table construction logic for wasm.


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

src/codegen/llvm.zig+6
...@@ -6544,6 +6544,12 @@ pub const FuncGen = struct {...@@ -6544,6 +6544,12 @@ pub const FuncGen = struct {
65446544
6545 const jmp_table: ?SwitchDispatchInfo.JmpTable = jmp_table: {6545 const jmp_table: ?SwitchDispatchInfo.JmpTable = jmp_table: {
6546 if (!is_dispatch_loop) break :jmp_table null;6546 if (!is_dispatch_loop) break :jmp_table null;
6547
6548 // Workaround for:
6549 // * https://github.com/llvm/llvm-project/blob/56905dab7da50bccfcceaeb496b206ff476127e1/llvm/lib/MC/WasmObjectWriter.cpp#L560
6550 // * https://github.com/llvm/llvm-project/blob/56905dab7da50bccfcceaeb496b206ff476127e1/llvm/test/MC/WebAssembly/blockaddress.ll
6551 if (zcu.comp.getTarget().isWasm()) break :jmp_table null;
6552
6547 // On a 64-bit target, 1024 pointers in our jump table is about 8K of pointers. This seems just6553 // On a 64-bit target, 1024 pointers in our jump table is about 8K of pointers. This seems just
6548 // about acceptable - it won't fill L1d cache on most CPUs.6554 // about acceptable - it won't fill L1d cache on most CPUs.
6549 const max_table_len = 1024;6555 const max_table_len = 1024;