summaryrefslogtreecommitdiff
path: root/mlir/lib/Transforms/Utils/Inliner.cpp
AgeCommit message (Collapse)Author
2025-07-27[MLIR] Fix release build: reference to NDEBUG guarded function (NFC)Mehdi Amini
With LDBG(), the code isn't guarded in release mode, even if the optimizer will remove it because there is a `if (false)` statement. We need the function declaration to be there at minima.
2025-07-27[MLIR] Update Inliner.cpp to use LDBG() for logging (NFC) (#150762)Mehdi Amini
2025-07-07[mlir] Use `llvm::fill` instead of `std::fill`(NFC) (#146889)Longsheng Mou
2025-06-29[mlir] Remove unused includes (NFC) (#146278)Kazu Hirata
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-06-09[mlir] Use *Map::try_emplace (NFC) (#143341)Kazu Hirata
- try_emplace(Key) is shorter than insert({Key, nullptr}). - try_emplace performs value initialization without value parameters. - We overwrite values on successful insertion anyway.
2025-04-05[mlir][inliner] Add doClone and canHandleMultipleBlocks callbacks to Inliner ↵junfengd-nv
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@gmail.com> Co-authored-by: Mehdi Amini <joker.eph@gmail.com>
2025-03-31[MLIR][NFC] Fix incomplete boundary comments. (#133516)Han-Chung Wang
I observed that we have the boundary comments in the codebase like: ``` //===----------------------------------------------------------------------===// // ... //===----------------------------------------------------------------------===// ``` I also observed that there are incomplete boundary comments. The revision is generated by a script that completes the boundary comments. ``` //===----------------------------------------------------------------------===// // ... ... ``` Signed-off-by: hanhanW <hanhan0912@gmail.com>
2025-01-24[mlir][inline] Fix Issue#82401: Infinite loop in MLIR inliner for indirect ↵junfengd-nv
recursive call. (#124026)
2024-03-13[RFC][mlir] Add profitability callback to the Inliner. (#84258)Slava Zakharin
Discussion at https://discourse.llvm.org/t/inliner-cost-model/2992 This change adds a callback that reports whether inlining of the particular call site (communicated via ResolvedCall argument) is profitable or not. The default MLIR inliner pass behavior is unchanged, i.e. the callback always returns true. This callback may be used to customize the inliner behavior based on the target specifics (like target instructions costs), profitability of the inlining for further optimizations (e.g. if inlining may enable loop optimizations or scalar optimizations due to object shape propagation), optimization levels (e.g. -Os inlining may be quite different from -Ofast inlining), etc. One of the questions is whether the ResolvedCall entity represents enough of the context for the custom inlining models to come up with the profitability decision. I think we can start with this and extend it as necessary. --------- Co-authored-by: Mehdi Amini <joker.eph@gmail.com>
2024-03-12[mlir][inline] avoid inline self-recursive function (#83092)Congcong Cai
2024-03-06[mlir][inliner] Refactor MLIR inliner pass and utils. (#84059)Slava Zakharin
This is just code refactoring done as a preparation for adding MLIR inliner cost model hook(s). Related discussion: https://discourse.llvm.org/t/inliner-cost-model/2992 The logic of SCC-based MLIR inliner is separated into the Inliner implementation. The MLIR inliner pass becomes, well, just a pass that invokes the SCC-based MLIR inliner.