Personal project · Nov 2026
LLVM 20 Loop Vectorization Analyzer
C++ · LLVM 20 · compilers · Clang · GCC · ScalarEvolution · DependenceAnalysis · lit / FileCheck · GitHub Actions
Why did LLVM leave this loop scalar? A compiler plugin that runs inside clang -O3 just before the
loop vectorizer, explains each rejected loop from LLVM's own analyses with a category, the evidence and a
source-level fix, checks its answers against LLVM, and repairs one class of blocked loops. 204 lit/FileCheck
tests run in GitHub Actions.
- 168 of 180 mostly held-out TSVC loops (93.3%, x86-64): same reason as LLVM's own vectorizer. PolyBench 163 of 163 was the tuning set.
- 13 of 14 suggested fixes make LLVM vectorize the loop.
- Repair pass: up to 5.79× on cholesky with
-ffast-math -march=native(1.05× in strict FP), 60 of 60 strict-FP outputs byte-identical. - Found and reproduced a wrong-result bug in LLVM 20.1.2's loop-interchange pass (checksum 1,961,666 → 171,990), fixed in LLVM 21.