[all-commits] [llvm/llvm-project] aeec94: [mlir][inliner] Add doClone and canHandleMultipleB...

junfengd-nv via All-commits all-commits at lists.llvm.org
Sat Apr 5 13:57:17 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aeec94500a5dbd576e5d2d16895fe00fa0b1e154
      https://github.com/llvm/llvm-project/commit/aeec94500a5dbd576e5d2d16895fe00fa0b1e154
  Author: junfengd-nv <junfengd at nvidia.com>
  Date:   2025-04-05 (Sat, 05 Apr 2025)

  Changed paths:
    M mlir/include/mlir/Transforms/Inliner.h
    M mlir/include/mlir/Transforms/InliningUtils.h
    M mlir/lib/Transforms/Utils/Inliner.cpp
    M mlir/lib/Transforms/Utils/InliningUtils.cpp
    A mlir/test/Transforms/test-inlining-callback.mlir
    M mlir/test/lib/Transforms/CMakeLists.txt
    M mlir/test/lib/Transforms/TestInlining.cpp
    A mlir/test/lib/Transforms/TestInliningCallback.cpp
    M mlir/tools/mlir-opt/mlir-opt.cpp

  Log Message:
  -----------
  [mlir][inliner] Add doClone and canHandleMultipleBlocks callbacks to Inliner Config (#131226)

Current inliner disables inlining when the caller is in a region with
single block trait, while the callee function contains multiple blocks.
the SingleBlock trait is used in operations such as do/while loop, for
example fir.do_loop, fir.iterate_while and fir.if. Typically, calls within
loops are good candidates for inlining. However, functions with multiple
blocks are also common. for example, any function with "if () then
return" will result in multiple blocks in MLIR.

This change gives the flexibility of a customized inliner to handle such
cases.
doClone: clones instructions and other information from the callee
function into the caller function. .
canHandleMultipleBlocks: checks if functions with multiple blocks can be
inlined into a region with the SingleBlock trait.

The default behavior of the inliner remains unchanged.

---------

Co-authored-by: jeanPerier <jean.perier.polytechnique at gmail.com>
Co-authored-by: Mehdi Amini <joker.eph at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list