[LLVMdev] the PartialSpecialization pass (was Re: Is there a "callback optimization"?)

NAKAMURA Takumi geek4civic at gmail.com
Fri Jun 4 12:39:16 PDT 2010

Good morning, Kenneth

Here is my patch for lib/Transforms/IPO/PartialSpecialization.cpp.
It works with my several applications but it is not widely tested.

The pass had a critical bug, ... when a specialized function is created,
all callers are modified. Even if a caller is not needed, to be malformed.
My fix includes to examine each of callers to be modified.

See also the discussion; http://llvm.org/bugs/show_bug.cgi?id=3757


2010/6/5 Kenneth Uildriks <kennethuil at gmail.com>:
>> As the number of callsites using the same constant grows, inlining
>> gets more expensive while specializing does not - the cost of
>> specializing only grows with the number of unique constants combos
>> specialized.  So cases where you'd want to specialize but not inline
>> shouldn't be all that uncommon, and different cost calculations are
>> needed to set the threshold.
>> I didn't see the partial specialization pass in the docs, but I'll
>> take a look at it now.
> Partial specialize is exactly what I need!  Thanks!
> It has a bug, though... I put in three calls using one function
> pointer, and three calls using another function pointer, and it
> created both specializations but changed all the callsites to use the
> first specialization.  I'll svn update, try again, and file a bug if
> needed.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PartialSpecialization.diff
Type: application/octet-stream
Size: 3484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100605/29f39cd6/attachment.obj>

More information about the llvm-dev mailing list