[Mlir-commits] [mlir] [RFC][mlir] Add profitability callback to the Inliner. (PR #84258)

Mehdi Amini llvmlistbot at llvm.org
Wed Mar 6 16:11:41 PST 2024


================
@@ -100,9 +100,12 @@ void InlinerPass::runOnOperation() {
     return signalPassFailure();
   }
 
+  // By default, assume that any inlining is profitable.
+  auto profitabilityCb = [](Inliner::ResolvedCall &) { return true; };
----------------
joker-eph wrote:

Can we add a pass option `int maxOperationCountToInline`  and when it is set walk the callee and online inline when below the threshold?

That would allow to write a test and showcase the feature here.

We could also do it as a percentage and count the number of operations in the calller, the callee, and only inline if the callee size if within x% of the caller size.

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


More information about the Mlir-commits mailing list