[PATCH] D153820: [CSSPGO][Preinliner] Always inline zero-sized functions.

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 16:45:29 PDT 2023


hoy updated this revision to Diff 535189.
hoy added a comment.

Updating D153820 <https://reviews.llvm.org/D153820>: [CSSPGO][Preinliner] Always inline zero-sized functions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153820/new/

https://reviews.llvm.org/D153820

Files:
  llvm/tools/llvm-profgen/CSPreInliner.h


Index: llvm/tools/llvm-profgen/CSPreInliner.h
===================================================================
--- llvm/tools/llvm-profgen/CSPreInliner.h
+++ llvm/tools/llvm-profgen/CSPreInliner.h
@@ -41,6 +41,14 @@
 struct ProfiledCandidateComparer {
   bool operator()(const ProfiledInlineCandidate &LHS,
                   const ProfiledInlineCandidate &RHS) {
+    // Always prioritize inlining zero-sized functions as they do not affect the
+    // size budget. This could happen when all of the callee's code is gone and
+    // only pseudo probes are left.
+    if (LHS.SizeCost == 0 || RHS.SizeCost == 0) {
+      if (LHS.SizeCost != RHS.SizeCost)
+        return RHS.SizeCost == 0;
+    }
+
     if (LHS.CallsiteCount != RHS.CallsiteCount)
       return LHS.CallsiteCount < RHS.CallsiteCount;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153820.535189.patch
Type: text/x-patch
Size: 807 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230627/ae7aa44d/attachment.bin>


More information about the llvm-commits mailing list