Ziv Ben-Zion

Clinical Neuroscientist

If-Convert as Early as You Must


Journal article


Dorit Nuzman, A. Zaks, Ziv Ben-Zion
International Conference on Compiler Construction, 2024

Semantic Scholar DBLP DOI
Cite

Cite

APA   Click to copy
Nuzman, D., Zaks, A., & Ben-Zion, Z. (2024). If-Convert as Early as You Must. International Conference on Compiler Construction.


Chicago/Turabian   Click to copy
Nuzman, Dorit, A. Zaks, and Ziv Ben-Zion. “If-Convert as Early as You Must.” International Conference on Compiler Construction (2024).


MLA   Click to copy
Nuzman, Dorit, et al. “If-Convert as Early as You Must.” International Conference on Compiler Construction, 2024.


BibTeX   Click to copy

@article{dorit2024a,
  title = {If-Convert as Early as You Must},
  year = {2024},
  journal = {International Conference on Compiler Construction},
  author = {Nuzman, Dorit and Zaks, A. and Ben-Zion, Ziv}
}

Abstract

Optimizing compilers employ a rich set of transformations that generate highly efficient code for a variety of source languages and target architectures. These transformations typically operate on general control flow constructs which trigger a range of optimization opportunities, such as moving code to less frequently executed paths, and more. Regular loop nests are specifically relevant for accelerating certain domains, leveraging architectural features including vector instructions, hardware-controlled loops and data flows, provided their internal control-flow is eliminated. Compilers typically apply predicating if-conversion late, in their backend, to remove control-flow undesired by the target. Until then, transformations triggered by control-flow constructs that are destined to be removed may end up doing more harm than good. We present an approach that leverages the existing powerful and general optimization flow of LLVM when compiling for targets without control-flow in loops. Rather than trying to teach various transformations how to avoid misoptimizing for such targets, we propose to introduce an aggressive if-conversion pass as early as possible, along with carefully addressing pass-ordering implications. This solution outperforms the traditional compilation flow with only a modest tuning effort, thereby offering a robust and promising compilation approach for branch-restricted targets.