[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 09:14:24 PDT 2008


On Thu, Sep 4, 2008 at 8:51 AM, Matthijs Kooijman <matthijs at stdin.nl> wrote:
> Hi Andrew,
>
> We've been using our specialization (internally dubbed function duplication)
> code for a very specific target, meaning that our policy is completely
> target-dependent. This means that I can't give any suggestions as to what a
> good policy would be in general, but also that just providing knobs and
> switches won't cut it for us. We really need to be able to plug in our own
> policy function to make this usable for us.

I can slightly refactor so you could inherit the class and just
specify the function for finding interesting arguments and a function
for approving specialization on certain constant/argument pairs.  I
hesitate to  make the policy a separate pass, but I would be willing
(esp when I add the code to remove the need to run IPSCCP and DAE
(which is simply a matter of using cloneFunction more efficiently)),
to move the mechanism into common code.

Would something like:

// Find all calls to F which have the Constant arguments in the
positions indicated by vals
// and replace those calls with a call to a version of F specialized
on those constants.
Function* specializeFunction(Function& F, SmallVector<pair<int,
Constant*> >& vals);

help you?  I.E. make this more like function cloning than function
inlining in terms of policy/mechanism separation.

Andrew



More information about the llvm-commits mailing list