authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-03-17 09:22:04+00:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-03-18 00:56:56+01:00
log032319c94257e650abc7a4743298154c218dba89
tree75fbbf3d77bd237c319aa87ed0186a463202b9ab
parent83add375c4734a6091dfc31563482b1b7157c1d6

llvm: disable loop vectorization for now

https://github.com/llvm/llvm-project/issues/186922 is pretty serious for us, because it is causing the Zig compiler itself to get miscompiled in many common configurations. I don't feel comfortable trying to work around this by disabling certain CPU features, because that seems incredibly brittle. I think it's probably best we disable loop vectorization entirely until we upgrade to a version of LLVM where this bug is fixed. This will pessimise codegen in some cases, which is unfortunate, but that's preferable to miscompilations.

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

src/zig_llvm.cpp+1-1
......@@ -285,7 +285,7 @@ ZIG_EXTERN_C bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machi
285285 PipelineTuningOptions pipeline_opts;
286286 pipeline_opts.LoopUnrolling = !options->is_debug;
287287 pipeline_opts.SLPVectorization = !options->is_debug;
288 pipeline_opts.LoopVectorization = !options->is_debug;
288 pipeline_opts.LoopVectorization = false; // https://github.com/llvm/llvm-project/issues/186922
289289 pipeline_opts.LoopInterleaving = !options->is_debug;
290290 pipeline_opts.MergeFunctions = !options->is_debug;
291291