[Mlir-commits] [mlir] [mlir][llvm] Fix crash in LLVM inliner when callee has no recognized terminator (PR #183949)
Matthias Springer
llvmlistbot at llvm.org
Sun Mar 1 00:41:57 PST 2026
================
@@ -725,6 +725,19 @@ struct LLVMInlinerInterface : public DialectInlinerInterface {
}))
return false;
}
+ // Refuse to inline if any block in the callee ends with an op that does
+ // not have the terminator trait. The MLIR verifier conservatively accepts
+ // unregistered ops as potential terminators, but the LLVM inliner's
+ // handleTerminator relies on the terminator being a recognized LLVM op
+ // (e.g. llvm.return). Inlining a callee with an unrecognized terminator
+ // would crash.
+ for (Block &block : funcOp.getBody()) {
+ if (!block.empty() && !block.back().hasTrait<OpTrait::IsTerminator>()) {
----------------
matthias-springer wrote:
Is it enough to check for `IsTerminator`? Based on the comment, it sounds like it must be an LLVM op.
https://github.com/llvm/llvm-project/pull/183949
More information about the Mlir-commits
mailing list