[llvm-commits] PATCH: Add a function splitting pass to LLVM which extracts cold regions into their own functions
hfinkel at anl.gov
Mon May 14 16:32:16 CDT 2012
I think this is neat.
I had an idea the other night which I'll mention, as it is related to
this proposal. I often see function calls that look like this:
type2_t used = compute_something(&unused);
Where the unused variable is actually much more expensive to compute
than the variable that is used. In fact, if the function could be
sliced so that the computation of the unused-by-expensive outputs is
separated from that of the used outputs, then the latter part might
actually be inlined (even though the entire function is too large).
This may be more complicated than what you've done, but might be
able to share some code with a hot/cold splitting pass.
On Sat, 5 May 2012 00:54:05 -0700
Chandler Carruth <chandlerc at gmail.com> wrote:
> Hello folks!
> I wanted to start the initial review on a pass I've been working on.
> It's essentially doing hot/cold partitioning, cold region extraction,
> function splitting, or cold region outlining. Whatever terminology
> you would like, you get the idea. It's a really simple pass, built
> entirely out of all the existing infrastructure (some of which I've
> been cleaning up to let everything fall out this easily).
> While this won't do a whole lot of interesting things on its own, I'm
> preparing to tweak the inline cost heuristics in a way that will
> allow this to form the essence of partial inlining. We can run this
> before inlining, splitting large cold regions of code into separate
> functions, and then be able to inline the remainder more easily.
> I haven't run benchmarks, and this patch doesn't turn the pass on, I
> just want to get initial feedback, and get the code into the shape
> where I can put it in-tree, and then look at turning it on if
> benchmarks prove positive.
> Comments? Also, is there a better pass name? Duncan had suggested
> cold-code-extract, not sure if thats better or not...
Leadership Computing Facility
Argonne National Laboratory
More information about the llvm-commits