[llvm-commits] [llvm] r55734 - in /llvm/trunk: include/llvm/LinkAllPasses.h include/llvm/Transforms/IPO.h lib/Transforms/IPO/PartialSpecialization.cpp

Andrew Lenharth andrewl at lenharth.org
Thu Sep 4 08:31:06 PDT 2008


On Thu, Sep 4, 2008 at 7:52 AM, Matthijs Kooijman <matthijs at stdin.nl> wrote:
> Cool to see a pass like this. I've been playing a bit with a highly similar
> pass a while back, but I seem to remember needing a lot more code (don't have
> the code at hand right now).

A lot more code would be needed to actually do the specialization.  I
just make clones so that IPSCCP and DAE will actually propagate the
constant and remove the argument.  It would easy enough with the
CloneFunction API to do the constant propagation into new function
(and this may save time), but I'd rather leave the DAE to DAE (though
again, this might be pretty easy to fold into the pass).

> Would it be a good idea to adapt this pass to seperate mechanism and policy,
> in a way similar to the inliner? In that case, we might be able to reuse this
> code.

Yes, once there are interesting policy choices.  Right now, policy
could be decided with a few flags and sensible default values.  The
policy decision is right now grouped into finding interesting
arguments and deciding the threshold (how often they are constant) for
specializing.  The mechanism itself is so simple (CloneFunction and
selective use updating) that I doesn't make sense right now to
separate them since the pass is almost entirely policy.

Any policy insights you had from when you played with this type of
thing would be appreciated since I have yet to make a heuristic that
helps in the general case (I have a specific test case that I am
working on, but it has a many calls to a few functions that take a
small distribution of constants and switch on the arguments).

Andrew



More information about the llvm-commits mailing list