10-20x Faster LLVM -O0 Back-End
10 days ago
- #compiler-optimization
- #LLVM
- #open-source
- TPDE-LLVM is an open-source fast LLVM baseline back-end, offering 10-20x faster compilation than LLVM -O0 with similar runtime performance but 10-30% larger code size.
- Supports a typical subset of LLVM-IR, targeting x86-64 and AArch64, with significant speedups demonstrated on SPEC CPU 2017 benchmarks.
- Three-pass approach: IR cleanup/preparation, analysis (loop+liveness), and combined lowering, regalloc, and machine code encoding.
- Current focus on supporting Clang O0/O1 IR, with plans for DWARF support, better register allocation, and potential expansion to non-ELF platforms and other targets.
- Identified LLVM-IR changes for faster compilation: eliminating ConstantExpr inside functions and arbitrarily-sized struct/array values.
- Performance challenges include bitcode parsing consuming ~90% of compilation time and quadratic runtime issues with certain IR constructs.