Dissertação de Mestrado
Otimizações de código sensíveis a contexto baseadas em clonagem de funções
Fecha
2014-02-21Autor
Matheus Silva Vilela
Institución
Resumen
Compilers rely on two main techniques to implement optimizations that depend on the calling context of functions: inlining and cloning. Historically, function inlining has seen more widespread use, as it tends to be more e ective in practice. Yet, function cloning provides bene ts that inline leaves behind. In particular, cloning gives the program developer a way to ght performance bugs, because it generates reusable code. Furthermore, it deals with recursion more naturally. Finally, it might lead to less code expansion, the inlining's nemesis.In this work, we revisit function cloning under the light of these bene ts. We discuss some independent code specialization techniques based on function cloning, which, although simple, nd wide applicability, even in highly optimized benchmarks, such as SPEC CPU 2006. We claim that our optimizations are easy to implement and deploy. We use Wu and Larus's well-known static pro ling heuristic to measure the pro tability of a clone. This metric gives us a concrete way to point out to program developers potential performance bugs, and gives us a metric to decide whether we keep a clone. By implementing our ideas in LLVM, we have been able to achieve signi cant speed up on the SPEC benchmarks on top of the -O2 optimization level..