[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 17:12:40 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4bdc938ce3f0: [CSSPGO][Preinliner] Always inline zero-sized functions. (authored by hoy).

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,13 @@
 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) &&
+        (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.535201.patch
Type: text/x-patch
Size: 800 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230628/6bc9d209/attachment.bin>


More information about the llvm-commits mailing list