TY - GEN
T1 - Loop Rolling for Code Size Reduction
AU - Rocha, Rodrigo C.O.
AU - Petoumenos, Pavlos
AU - Franke, Bjorn
AU - Bhatotia, Pramod
AU - O'Boyle, Michael
N1 - Publisher Copyright:
© 2022 IEEE.
PY - 2022
Y1 - 2022
N2 - Code size is critical for resource-constrained devices, where memory and storage are limited. Compilers, therefore, should offer optimizations aimed at code reduction. One such optimization is loop rerolling, which transforms a partially unrolled loop into a fully rolled one. However, existing techniques are limited and rarely applicable to real-world programs. They are incapable of handling partial rerolling or straight-line code. In this paper, we propose RoLAG, a novel code-size optimization that creates loops out of straight-line code. It identifies isomorphic code by aligning SSA graphs in a bottom-up fashion. The aligned code is later rolled into a loop. In addition, we propose several optimizations that increase the amount of aligned code by identifying specific patterns of code. Finally, an analysis is used to estimate the profitability of the rolled loop before deciding which version should be kept in the code.Our evaluation of RoLAG on full programs from MiBench and SPEC 2017 show absolute reductions of up to 88 KB while LLVM's technique is hardly distinguishable from the baseline with no rerolling. Finally, our results show that RoLAG is highly applicable to real-world code extracted from popular GitHub repositories. RoLAG is triggered several orders of magnitude more often than LLVM's rerolling, resulting in meaningful reductions on real-world functions.
AB - Code size is critical for resource-constrained devices, where memory and storage are limited. Compilers, therefore, should offer optimizations aimed at code reduction. One such optimization is loop rerolling, which transforms a partially unrolled loop into a fully rolled one. However, existing techniques are limited and rarely applicable to real-world programs. They are incapable of handling partial rerolling or straight-line code. In this paper, we propose RoLAG, a novel code-size optimization that creates loops out of straight-line code. It identifies isomorphic code by aligning SSA graphs in a bottom-up fashion. The aligned code is later rolled into a loop. In addition, we propose several optimizations that increase the amount of aligned code by identifying specific patterns of code. Finally, an analysis is used to estimate the profitability of the rolled loop before deciding which version should be kept in the code.Our evaluation of RoLAG on full programs from MiBench and SPEC 2017 show absolute reductions of up to 88 KB while LLVM's technique is hardly distinguishable from the baseline with no rerolling. Finally, our results show that RoLAG is highly applicable to real-world code extracted from popular GitHub repositories. RoLAG is triggered several orders of magnitude more often than LLVM's rerolling, resulting in meaningful reductions on real-world functions.
KW - Code-Size Reduction
KW - Compiler optimization
KW - LLVM
KW - Loop Rerolling
KW - Loop optimization
UR - http://www.scopus.com/inward/record.url?scp=85128365942&partnerID=8YFLogxK
U2 - 10.1109/CGO53902.2022.9741256
DO - 10.1109/CGO53902.2022.9741256
M3 - Conference contribution
AN - SCOPUS:85128365942
T3 - CGO 2022 - Proceedings of the 2022 IEEE/ACM International Symposium on Code Generation and Optimization
SP - 217
EP - 229
BT - CGO 2022 - Proceedings of the 2022 IEEE/ACM International Symposium on Code Generation and Optimization
A2 - Lee, Jae W.
A2 - Hack, Sebastian
A2 - Shpeisman, Tatiana
PB - Institute of Electrical and Electronics Engineers Inc.
T2 - 20th IEEE/ACM International Symposium on Code Generation and Optimization, CGO 2022
Y2 - 2 April 2022 through 6 April 2022
ER -