[Mlir-commits] [mlir] [mlir][LLVMIR] Require active insertion point for llvm.call translation (PR #222920)

Christian Ulmann llvmlistbot at llvm.org
Thu Oct 1 05:21:40 PDT 2026


================
@@ -429,3 +429,13 @@ llvm.func @invoke_branch_weights() -> i32 attributes {personality = @__gxx_perso
 ^bb2:  // 2 preds: ^bb0, ^bb1
   llvm.return %0 : i32
 }
+
+// -----
+
+// Test that llvm.call at module scope (outside any function) produces a proper
+// error instead of leaving a parentless CallInst that crashes the module
+// destructor during LLVM IR translation.
+llvm.func @barrier()
+// expected-error @+2 {{'llvm.call' op cannot be translated to LLVM IR without an active insertion point}}
+// expected-error @+1 {{LLVM Translation failed for operation: llvm.call}}
+llvm.call @barrier() : () -> ()
----------------
Dinistro wrote:

Would it make more sense to enforce that the llvm.call is somewhere nested within a function in the general case?

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


More information about the Mlir-commits mailing list