[Mlir-commits] [mlir] [mlir][llvm] Fix crash in LLVM inliner when callee has no recognized terminator (PR #183949)
Mehdi Amini
llvmlistbot at llvm.org
Sun Mar 1 03:30:42 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>()) {
----------------
joker-eph wrote:
Added test to show CF branch and updated the comment here, PTAL!
https://github.com/llvm/llvm-project/pull/183949
More information about the Mlir-commits
mailing list