New Optimization Sequences for Code-Size Reduction for the LLVM Compilation Infrastructure

  • Anderson Faustino UEM
  • Edson Borin UNICAMP
  • Fernando Pereira UFMG
  • Otávio Nápoli UNICAMP
  • Vanderson Rosário UNICAMP

Resumo


Typical compilers provide users with default optimization levels: sequences of code-transformation passes that can be tuned to either generate faster or smaller executables. Regarding this last dimension of efficiency—size—clang contains two optimization levels: Os and Oz. Both cause the invocation of a large number of passes: 264 and 260, respectively. In this paper, we explore the following question: is it possible to find shorter sequences that deliver similar results? To provide an answer to such a question, we have compiled 15,000 different programs with 10,044 optimization sequences, each with up to 100 code-transformation passes. Promising sequences, once selected, were then systematically reduced. From this effort, we have chosen five optimization sequences containing from 12 to 15 code transformations. When applied onto SPEC CPU2017, these sequences yield compilation times that are 1.4 − 1.6x and 1.3 − 1.5x faster than the Os and Oz optimization levels of LLVM. Moreover, one of the selected sequences produced code that is 2.3% smaller than LLVM’s Os level, and only 2.5% larger than the Oz level.

Publicado
30/09/2021
FAUSTINO, Anderson; BORIN, Edson; PEREIRA, Fernando; NÁPOLI, Otávio; ROSÁRIO, Vanderson. New Optimization Sequences for Code-Size Reduction for the LLVM Compilation Infrastructure. In: SIMPÓSIO BRASILEIRO DE LINGUAGENS DE PROGRAMAÇÃO (SBLP), 25. , 2021, Joinville. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2021 . p. 33–40.