[Mlir-commits] [mlir] [mlir][func] Avoid to create duplicate symbol during conversion (PR #192342)

Slava Zakharin llvmlistbot at llvm.org
Tue Apr 21 08:46:38 PDT 2026


================
@@ -87,6 +87,17 @@ mlir::LLVM::lookupOrCreateFn(OpBuilder &b, Operation *moduleOp, StringRef name,
     return func;
   }
 
+  // A symbol with this name may already exist as a non-LLVM function (e.g.,
+  // func::FuncOp from user code that hasn't been converted to LLVM dialect
+  // yet). Creating a new LLVMFuncOp with the same name would cause a symbol
+  // redefinition error. Return failure so the calling pattern can retry after
+  // the existing symbol is converted.
+  if (symbolTables
----------------
vzakhari wrote:

Can we change `lookupFuncOp` to return `FunctionOpInterface` instance? Then above in this function we can check if it is `llvm.func` or not (in which case we'll return failure and wait for its conversion later).

This is just a suggestion, and I am okay with the changes as-is.

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


More information about the Mlir-commits mailing list