[PATCH] D119880: [FuncSpec] Support function specialization across multiple arguments.

Alexandros Lamprineas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 11 06:48:40 PST 2022


labrinea added a comment.

I've tried another formula to determine the amount of speciazations we are keeping (instead of `Sorted.size()/2`). It is defined as `auto NumSpecKept = (size_t)std::log10(std::pow(Sorted.size(), 4))+1;`. The idea is to keep the compilation times down in case of a source file which results in many candidate specializations (I haven't seen any but you never know).

Here are some values of `f(x) = log10(n^4)+1` rounded to integer:
f(1) =1
f(2) = 2
f(3) = 2
f(4) = 3
f(5) = 3
f(6) = 4
...
f(10) = 5
...
f(100) = 9
...
f(1000) = 13

Posting some statistics from running the llvm test suite at -O3 on AArch64:

| **test name**                                 | **num specializations one arg** | **num specializations mult args (sorted: keep n/2)** | **num specializations mult args (sorted: keep log10(n^4)+1)** |  |
| MultiSource/Applications/ClamAV/clamscan.test | 3                               | 3                                                    | 4                                                             |
| MultiSource/Applications/d/make_dparser.test  | 1                               | 0                                                    | 1                                                             |
| MultiSource/Applications/oggenc/oggenc.test   | 2                               | 1                                                    | 2                                                             |
| MultiSource/Applications/sqlite3/sqlite3.test | 3                               | 3                                                    | 4                                                             |


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119880/new/

https://reviews.llvm.org/D119880



More information about the llvm-commits mailing list