Abstract
Compilers perform a variety of advanced optimizations to improve the quality of the generated machine code. However, optimizations that depend on the data flow of a program are often limited by control-flow merges. Code duplication can solve this problem by hoisting, i.e. duplicating, instructions from merge blocks to their predecessors. However, finding optimization opportunities enabled by duplication is a non-trivial task that requires compile-time intensive analysis. This imposes a challenge on modern (just-in-time) compilers: Duplicating instructions tentatively at every control flow merge is not feasible because excessive duplication leads to uncontrolled code growth and compile time increases. Therefore, compilers need to find out whether a duplication is beneficial enough to be performed.
This paper proposes a novel approach to determine which duplication operations should be performed to increase performance. The approach is based on a duplication simulation that enables a compiler to evaluate different success metrics per potential duplication. Using this information, the compiler can then select the most promising candidates for optimization. We show how to map duplication candidates into an optimization cost model that allows us to trade-off between different success metrics including peak performance, code size and compile time.
We implemented the approach on top of the GraalVM and evaluated it with the benchmarks Java DaCapo, Scala DaCapo, JavaScript Octane and a micro-benchmark suite, in terms of performance, compilation time and code size increase.
We show that our optimization can reach peak performance improvements of up to 40% with a mean peak performance increase of 5.89%, while it generates a mean code size increase of 9.93% and mean compile time increase of 18.44%.
Original language | English |
---|---|
Title of host publication | Proceeding CGO 2018 Proceedings of the 2018 International Symposium on Code Generation and Optimization |
Publisher | ACM |
Pages | 126-137 |
Number of pages | 12 |
ISBN (Print) | 978-1-4503-5617-6 |
DOIs | |
Publication status | Published - Feb 2018 |
Fields of science
- 102 Computer Sciences
- 102009 Computer simulation
- 102011 Formal languages
- 102013 Human-computer interaction
- 102022 Software development
- 102024 Usability research
- 102029 Practical computer science
JKU Focus areas
- Computation in Informatics and Mathematics
- Engineering and Natural Sciences (in general)