A Multi-Dimensional, Per-Pass Empirical Study of the LLVM Optimization Pipeline

📅 2026-06-30
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This study addresses the challenges of pass ordering, selection, and performance analysis in LLVM’s -O3 optimization pipeline by systematically decomposing the optimization process into per-pass prefixes. Conducting 84,750 noise-controlled experiments across 30 PolyBench/C kernels, the work comprehensively evaluates multidimensional metrics including execution time, compilation overhead, binary size, hardware counters, and energy consumption. It reveals for the first time that optimization benefits are highly concentrated in a few critical passes, that -O3 is rarely Pareto-optimal across programs, and that IR instruction count poorly predicts runtime performance. The study establishes a theoretical upper bound on phase-ordering interference loss and demonstrates that 6.6–9.7% of passes degrade performance, 84.8% of the full pipeline is needed to achieve 80% of peak speedup, and runtime-synchronized optimizations can reduce energy usage by 30–60%, providing an empirical foundation for autotuning and cost-model calibration.
📝 Abstract
Quantifying the marginal impact of individual optimization passes underpins phase ordering, pass selection, optimization design, and analysis of pass/hardware interactions. In LLVM -- the standard backend for C/C++, Rust, and ML stacks via MLIR -- interactions among optimization passes, measurement noise, and pipeline scale make this difficult. We present a systematic, empirical study of the LLVM -O3 optimization pipeline. We decompose the pipeline into cumulative per-pass prefixes. We then measure execution time, compile time, binary size, hardware counters, and RAPL energy across 84,750 measurements covering 113 cumulative prefixes of the -O3 pipeline evaluated on 30 PolyBench/C kernels under rigorous noise mitigation. On these compute-bound affine kernels, the pipeline is non-monotone (6.6-9.7% of transitions regress) and strongly back-loaded (the median non-regressing kernel needs 84.8% of the pipeline for 80% of its speedup). Most gains are driven by a small Pareto-dominant core of passes, while the final -O3 configuration is Pareto-dominated on (size, speedup) for 29 of 30 kernels. We further show that IR instruction count is an unreliable predictor of runtime, that runtime-targeted passes are de facto energy-targeted (30-60% savings), and that the search-free idealized-additive upper bound on losses due to phase interference is 46.35%. These findings enable more informed pass pruning, cost-model calibration, and autotuning.
Problem

Research questions and friction points this paper is trying to address.

LLVM optimization
phase ordering
empirical study
optimization passes
performance regression
Innovation

Methods, ideas, or system contributions that make the work stand out.

LLVM optimization pipeline
empirical study
phase ordering
Pareto-dominant passes
optimization interference