Skip to content

Commit

Permalink
[CodeMetrics] use hasOneLiveUse instead of hasOneUse while analyzing …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
linsinan1995 authored and ChuanqiXu9 committed Jul 26, 2022
1 parent 94c00c1 commit 7a2f5dc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion llvm/lib/Analysis/CodeMetrics.cpp
Expand Up @@ -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;
}

Expand Down

0 comments on commit 7a2f5dc

Please sign in to comment.