[Mlir-commits] [mlir] [mlir][Inliner] Fix crash when inlining callee without terminator (PR #173665)

Matthias Springer llvmlistbot at llvm.org
Sat Dec 27 01:59:03 PST 2025


================
@@ -682,7 +682,14 @@ Inliner::Impl::inlineCallsInSCC(InlinerInterfaceImpl &inlinerIface,
     useList.mergeUsesAfterInlining(it.targetNode, it.sourceNode);
 
     // then erase the call.
-    call.erase();
+    if (call.getOperation()->use_empty()) {
+      call.erase();
+    } else {
+      LDBG() << "CallOpInterface is still in use. call = " << call
+             << " returning failure";
+      call->emitError("not all uses of call were replaced");
----------------
matthias-springer wrote:

It's interesting that the LLVM dialect does not verify the terminator of the `llvm.func` op.

I'd like to understand if this is the correct place to error out. Maybe we should have never tried to inline the function? I don't know this pass well enough to say for sure.

https://github.com/llvm/llvm-project/pull/173665


More information about the Mlir-commits mailing list