Loop Rolling for Code Size Reduction

  • Rodrigo C.O. Rocha
  • , Pavlos Petoumenos
  • , Bjorn Franke
  • , Pramod Bhatotia
  • , Michael O'Boyle

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review

16 Scopus citations

Abstract

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.

Original languageEnglish
Title of host publicationCGO 2022 - Proceedings of the 2022 IEEE/ACM International Symposium on Code Generation and Optimization
EditorsJae W. Lee, Sebastian Hack, Tatiana Shpeisman
PublisherInstitute of Electrical and Electronics Engineers Inc.
Pages217-229
Number of pages13
ISBN (Electronic)9781665405843
DOIs
StatePublished - 2022
Event20th IEEE/ACM International Symposium on Code Generation and Optimization, CGO 2022 - Seoul, Korea, Republic of
Duration: 2 Apr 20226 Apr 2022

Publication series

NameCGO 2022 - Proceedings of the 2022 IEEE/ACM International Symposium on Code Generation and Optimization

Conference

Conference20th IEEE/ACM International Symposium on Code Generation and Optimization, CGO 2022
Country/TerritoryKorea, Republic of
CitySeoul
Period2/04/226/04/22

Keywords

  • Code-Size Reduction
  • Compiler optimization
  • LLVM
  • Loop Rerolling
  • Loop optimization

Fingerprint

Dive into the research topics of 'Loop Rolling for Code Size Reduction'. Together they form a unique fingerprint.

Cite this