[PATCH] D130461: [CodeMetrics] use hasOneLiveUse instead of hasOneUse while analyzing inlinable callsites

Sinan Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 00:36:42 PDT 2022


sinan created this revision.
sinan added a project: LLVM.
Herald added a subscriber: hiraditya.
Herald added a project: All.
sinan requested review of this revision.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130461

Files:
  llvm/lib/Analysis/CodeMetrics.cpp


Index: llvm/lib/Analysis/CodeMetrics.cpp
===================================================================
--- llvm/lib/Analysis/CodeMetrics.cpp
+++ llvm/lib/Analysis/CodeMetrics.cpp
@@ -133,7 +133,8 @@
         // 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;
         }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130461.447205.patch
Type: text/x-patch
Size: 578 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220725/cb13527b/attachment.bin>


More information about the llvm-commits mailing list