[all-commits] [llvm/llvm-project] 20b03d: [FuncSpec] Decouple cost/benefit analysis, allowin...
sjoerdmeijer via All-commits
all-commits at lists.llvm.org
Thu Dec 16 03:57:58 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 20b03d65364d963585bf16f175b367f3842f223a
https://github.com/llvm/llvm-project/commit/20b03d65364d963585bf16f175b367f3842f223a
Author: Sjoerd Meijer <sjoerd.meijer at arm.com>
Date: 2021-12-16 (Thu, 16 Dec 2021)
Changed paths:
M llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
Log Message:
-----------
[FuncSpec] Decouple cost/benefit analysis, allowing sorting of candidates.
This mostly is the same code that is refactored to decouple the cost and
benefit analysis. The biggest change is top-level function specializeFunctions
that now drives the transformation more like this:
specializeFunctions() {
Cost = getSpecializationCost(F);
calculateGains(F, Cost);
specializeFunction(F);
}
while this is just a restructuring, it helps the functional change in
calculateGains. I.e., we now sort the candidates based on the expected
specialisation gain, which we didn't do before. For this, a book keeping struct
ArgInfo was introduced. If we have a list of N candidates, but we only want
specialise less than N as set by option -func-specialization-max-constants, we
sort the list and discard the candidates that give the least benefit.
Given a formal argument, this change results in selecting the best actual
argument(s). This is NFC'ish in that this shouldn't change the current output
(hence no test change here), but in follow ups starting with D115509, it
should and I want to go one step further and compare all functions and all
arguments, which will mostly build on top of this refactoring and change.
Differential Revision: https://reviews.llvm.org/D115458
More information about the All-commits
mailing list