aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/CodeMetrics.cpp
diff options
context:
space:
mode:
authorSinan Lin <sinan.lin@linux.alibaba.com>2022-07-26 13:45:13 +0800
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>2022-07-26 13:46:19 +0800
commit7a2f5dca09f022ca56d661acdd919da32147e767 (patch)
treeb9b32bba8406562bd926ed3b65b137554a95f386 /llvm/lib/Analysis/CodeMetrics.cpp
parent94c00c10e837aded6a6b15fe84c12f1ced4d856d (diff)
downloadllvm-7a2f5dca09f022ca56d661acdd919da32147e767.zip
llvm-7a2f5dca09f022ca56d661acdd919da32147e767.tar.gz
llvm-7a2f5dca09f022ca56d661acdd919da32147e767.tar.bz2
[CodeMetrics] use hasOneLiveUse instead of hasOneUse while analyzing inlinable callsites
It would be better for CodeMetrics to use hasOneLiveUse while analyzing static and called once callsites, since inline cost now uses hasOneLiveUse instead of hasOneUse to avoid overpessimization on dead constant cases (since this patch https://reviews.llvm.org/D109294). This change has no noticeable influence now, but it helps improve the accuracy of cost models of passes that use CodeMetrics. Reviewed By: fhahn, nikic Differential Revision: https://reviews.llvm.org/D130461
Diffstat (limited to 'llvm/lib/Analysis/CodeMetrics.cpp')
-rw-r--r--llvm/lib/Analysis/CodeMetrics.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/CodeMetrics.cpp b/llvm/lib/Analysis/CodeMetrics.cpp
index 6d90842..ded842b 100644
--- a/llvm/lib/Analysis/CodeMetrics.cpp
+++ b/llvm/lib/Analysis/CodeMetrics.cpp
@@ -133,7 +133,8 @@ void CodeMetrics::analyzeBasicBlock(
// When preparing for LTO, liberally consider calls as inline
// candidates.
if (!Call->isNoInline() && IsLoweredToCall &&
- ((F->hasInternalLinkage() && F->hasOneUse()) || PrepareForLTO)) {
+ ((F->hasInternalLinkage() && F->hasOneLiveUse()) ||
+ PrepareForLTO)) {
++NumInlineCandidates;
}