Hi Everyone, I was one of the original authors of hot cold splitting optimization in LLVM. I was wondering if implementing a region based hot cold splitting optimization would be useful in GCC? We already have optimal implementation of SESE region detection in GCC (https://github.com/gcc-mirror/gcc/blob/master/gcc/sese.h) so implementation of hot cold splitting at IR level could leverage some of that.
Motivation: With the increasing popularity of RISC-V architecture, where most applications are constrained for code-size. I assume those applications would (soon) be suffering from app launch time and page faults. I don't have numbers for this sorry, just a guess. Having an IR level hot cold splitting pass would benefit applications deployed on such devices by reducing their startup working set. I'd be happy to mentor a GSoC candidate if we chose to list this as one of the projects. Description of the project: Region based Hot Cold Splitting is an IR level function splitting transformation. The goal of hot/cold splitting is to improve the memory locality of code and helps reduce startup working set. The splitting pass does this by identifying cold blocks and moving them into separate functions. Because it is implemented at the IR level all the back end target benefit from it. It is a relatively new optimization and it was recently presented at the LLVM Dev Meeting in 2019 and the slides are here: https://llvm.org/devmtg/2019-10/talk-abstracts.html#tech8. There are fast algorithms to detect SESE regions as illustrated in (http://impact.gforge.inria.fr/impact2016/papers/impact2016-kumar.pdf), we can leverage that to detect regions. Deliverables: - Implement hot cold splitting pass at GIMPLE level - Detect maximal cold region in a function and outline it as a separate function - Use static as well as dynamic profile information to mark cold edges - Write unit tests to show variety of regions outlined Thanks, -Aditya