aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/CodeMetrics.cpp
diff options
context:
space:
mode:
authorSam Parker <sam.parker@arm.com>2020-04-27 09:02:14 +0100
committerSam Parker <sam.parker@arm.com>2020-04-28 08:57:45 +0100
commite9c9329aa44e803416c3749e5a2e22d5a768f62a (patch)
treef1f050866d8247dfd285e4a9ae3c9ad38b74d2cc /llvm/lib/Analysis/CodeMetrics.cpp
parente849e7a700907441ee82ace9d0a9555ae7eb9811 (diff)
downloadllvm-e9c9329aa44e803416c3749e5a2e22d5a768f62a.zip
llvm-e9c9329aa44e803416c3749e5a2e22d5a768f62a.tar.gz
llvm-e9c9329aa44e803416c3749e5a2e22d5a768f62a.tar.bz2
[TTI] Add TargetCostKind argument to getUserCost
There are several different types of cost that TTI tries to provide explicit information for: throughput, latency, code size along with a vague 'intersection of code-size cost and execution cost'. The vectorizer is a keen user of RecipThroughput and there's at least 'getInstructionThroughput' and 'getArithmeticInstrCost' designed to help with this cost. The latency cost has a single use and a single implementation. The intersection cost appears to cover most of the rest of the API. getUserCost is explicitly called from within TTI when the user has been explicit in wanting the code size (also only one use) as well as a few passes which are concerned with a mixture of size and/or a relative cost. In many cases these costs are closely related, such as when multiple instructions are required, but one evident diverging cost in this function is for div/rem. This patch adds an argument so that the cost required is explicit, so that we can make the important distinction when necessary. Differential Revision: https://reviews.llvm.org/D78635
Diffstat (limited to 'llvm/lib/Analysis/CodeMetrics.cpp')
-rw-r--r--llvm/lib/Analysis/CodeMetrics.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/CodeMetrics.cpp b/llvm/lib/Analysis/CodeMetrics.cpp
index 0e571ca..a0b9363 100644
--- a/llvm/lib/Analysis/CodeMetrics.cpp
+++ b/llvm/lib/Analysis/CodeMetrics.cpp
@@ -172,7 +172,7 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB,
if (InvI->cannotDuplicate())
notDuplicatable = true;
- NumInsts += TTI.getUserCost(&I);
+ NumInsts += TTI.getUserCost(&I, TargetTransformInfo::TCK_CodeSize);
}
if (isa<ReturnInst>(BB->getTerminator()))