Speculative Recursion Unrolling
摘要
In this paper, we propose a novel, annotation based approach to optimize recursive functions in C/C++ codes. It can be used to fully remove recursive structures, optimize the working pattern and gives the developer fine grain control over inlining behavior, leading to speedups of up to 40x. To achieve this we use Clang annotations and have developed an LLVM compiler pass that parses the developer given annotation and transforms the code accordingly. We demonstrate the effectiveness of this approach on 5 well known recursive algorithms. Our experiments show, that recursive functions that are not limited by memory bandwidth but computation intensity benefit the most from this optimization. Our code is available at https://github.com/tudasc/SpecRecUnroll .