[PATCH] D120908: [FuncSpec] Enable function specialize for a constant range of arguments.

Joseph Faulls via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 3 07:18:53 PST 2022


Joe created this revision.
Joe added reviewers: SjoerdMeijer, labrinea.
Herald added subscribers: snehasish, ormris, pengfei, hiraditya.
Herald added a project: All.
Joe requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This will consider function specialization for candidate constants in a
constant range where the range represents all the possible arguments.

Arguments from calls that are constant ranges themselves are still
unsupported.

I have a feeling I might be missing something here. Is there a reason why this wasn't already the case?

Tests affected (function-specialization.NumFuncSpecialized)

| test                                           | before | after |
| MultiSource/Applications/SPASS/SPASS.test      | NaN    | 11.00 |
| MultiSource/Applications/JM/ldecod/ldecod.test | NaN    | 3.00  |
| MultiSource/Applications/oggenc/oggenc.test    | 2.00   | 3.00  |
|

I tried measuring performance (Cycles/Instructions) with perf on x86, but there was too much noise in the results to gather anything meaningful.

Looking into the specialisations themselves, it often looks good. For some it introduces inlining opportunities. However, whether or not these were objectively good changes should be handled by the cost analysis. This change simply considers more opportunities.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120908

Files:
  llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
  llvm/test/Transforms/FunctionSpecialization/function-specialization6.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120908.412699.patch
Type: text/x-patch
Size: 3973 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220303/de8827b2/attachment.bin>


More information about the llvm-commits mailing list