[llvm-branch-commits] [llvm] [llvm-profgen] Use always_inline/noinline attributes in pre-inliner (PR #234094)

Kunal Pathak via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Nov 18 11:53:14 PST 2026


================
@@ -241,14 +241,18 @@ void CSPreInliner::processFunction(const FunctionId Name) {
   ProfiledCandidateQueue CQueue;
   getInlineCandidates(CQueue, FSamples);
 
+  // Candidates left out because the size budget is spent.
+  SmallVector<ProfiledInlineCandidate> OverBudget;
   while (!CQueue.empty()) {
-    // Inlines always_inline callees regardless of the budget.
-    if (FuncFinalSize >= SizeLimit &&
-        !CQueue.top().CalleeSamples->getContext().hasAttribute(
-            ContextAlwaysInline))
-      break;
     ProfiledInlineCandidate Candidate = CQueue.top();
     CQueue.pop();
+    // Inlines always_inline callees regardless of the budget.
----------------
kunalspathak wrote:

This is the part I am not sure about. We are basically inlining cold calls as well if they are marked `always_inline`. Sometimes, there can be lot of library functions that are all marked as `always_inline` but are cold. Don't think we should inline them, specially ignoring the size budget? Perhaps we can inline them only as long as it doesn't cross the size budget?

https://github.com/llvm/llvm-project/pull/234094


More information about the llvm-branch-commits mailing list