[llvm] InlineFunction: Split inlining into predicate and apply functions (PR #134213)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 13 00:50:56 PDT 2025


================
@@ -334,7 +334,11 @@ std::optional<InlineCostFeatures> getInliningCostFeatures(
     ProfileSummaryInfo *PSI = nullptr,
     OptimizationRemarkEmitter *ORE = nullptr);
 
-/// Minimal filter to detect invalid constructs for inlining.
+/// Check if it is mechanically possible to inline the function \p Callee, based
+/// on the contents of the function.
+///
+/// See also \p CanInlineCallSite as an additional precondition necessary to
+/// perform a valid inline in a particular use context.
----------------
arsenm wrote:

They should not be one function, and I think I think the split makes sense, but the names need work. A wrapper function which calls the two would be useful, but they should be available as the split parts.

 isInlineViable is a restriction on ever inlining the function based on the callee's properties. As in, the inliner cannot physically inline the function. You can pre-filter handling functions which will never be inlined.

CanInlineCallsite is for context sensitive restrictions at the specific callsite. It's a property of the caller, more than the callee 

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


More information about the llvm-commits mailing list