An Empirical Study of the Effect of Source-level Loop Transformations on Compiler Stability
Loop-level compiler optimizations are applied in a complex process with no guarantee that the code produced is optimal. Compilers also struggle to maintain a stable performance on different loops with the same semantics. This paper presents an analysis of the stability of the compilation process and shows potential for state-of-the-art compilers to improve code performance. In the study, loop nests are first extracted from benchmarks; then, sequences of source-level loop transformations are applied to these loop nests to create numerous semantically equivalent mutations; finally, the impact of transformations on code quality in terms of locality, dynamic instruction count, and vectorization is analyzed for different compilers. Our results show that up to 47% of the loops can be improved with at least a 1.15x speedup by this process while the average speedup can reach 1.6x for the improved loops. In addition, we propose a novel stability score that demonstrates the difference in stability from the studied compilers. The study concludes that the effect of source-level transformations varies among compilers, and the evaluated compilers have long ways to go until reaching stable.