[Mlir-commits] [mlir] [mlir][inliner] Add doClone and canHandleMultipleBlocks callbacks to Inliner (PR #131226)
Mehdi Amini
llvmlistbot at llvm.org
Thu Apr 3 02:59:57 PDT 2025
================
@@ -60,6 +73,28 @@ class InlinerConfig {
/// For SCC-based inlining algorithms, specifies maximum number of iterations
/// when inlining within an SCC.
unsigned maxInliningIterations{0};
+ /// Callback for cloning operations during inlining
+ CloneCallbackTy cloneCallback = [](OpBuilder &builder, Region *src,
+ Block *inlineBlock, Block *postInsertBlock,
+ IRMapping &mapper,
+ bool shouldCloneInlinedRegion) {
+ // Check to see if the region is being cloned, or moved inline. In
+ // either case, move the new blocks after the 'insertBlock' to improve
+ // IR readability.
+ Region *insertRegion = inlineBlock->getParent();
+ if (shouldCloneInlinedRegion)
+ src->cloneInto(insertRegion, postInsertBlock->getIterator(), mapper);
+ else
+ insertRegion->getBlocks().splice(postInsertBlock->getIterator(),
+ src->getBlocks(), src->begin(),
+ src->end());
+ };
+ /// Determining if the inliner can inline a function containing multiple
----------------
joker-eph wrote:
```suggestion
/// Determine if the inliner can inline a function containing multiple
```
https://github.com/llvm/llvm-project/pull/131226
More information about the Mlir-commits
mailing list