aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorAlexandros Lamprineas <alexandros.lamprineas@arm.com>2023-08-07 13:34:48 +0100
committerAlexandros Lamprineas <alexandros.lamprineas@arm.com>2023-08-09 10:28:46 +0100
commitd1b376fd7bf73bca557f3c174d4c129ed4d45ae5 (patch)
treef5abc9aa8f7b3da0b00ddb1388a575102cb9a5a7 /clang/lib/Frontend/CompilerInvocation.cpp
parent7ec88f06d5833dfb4c7029c7645ae6cb89520504 (diff)
downloadllvm-d1b376fd7bf73bca557f3c174d4c129ed4d45ae5.zip
llvm-d1b376fd7bf73bca557f3c174d4c129ed4d45ae5.tar.gz
llvm-d1b376fd7bf73bca557f3c174d4c129ed4d45ae5.tar.bz2
[FuncSpec] Rework the discardment logic for unprofitable specializations.
Currently we make an arbitrary comparison between codesize and latency in order to decide whether to keep a specialization or not. Sometimes the latency savings are biased in favor of loops because of imprecise block frequencies, therefore this metric contains a lot of noise. This patch tries to address the problem as follows: * Reject specializations whose codesize savings are less than X% of the original function size. * Reject specializations whose latency savings are less than Y% of the original function size. * Reject specializations whose inlining bonus is less than Z% of the original function size. I am not saying this is super precise, but at least X, Y and Z are configurable, allowing us to tweak the cost model. Moreover, it lets us prioritize codesize over latency, which is a less noisy metric. I am also increasing the minimum size a function should have to be considered a candidate for specialization. Initially the cost of a function was calculated as CodeMetrics::NumInsts * InlineConstants::getInstrCost() which later in D150464 was altered into CodeMetrics::NumInsts since the metric is supposed to model TargetTransformInfo::TCK_CodeSize. However, we omitted adjusting MinFunctionSize in that commit. Differential Revision: https://reviews.llvm.org/D157123
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions