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

Valentin Clement バレンタイン クレメン llvmlistbot at llvm.org
Thu Apr 16 10:01:52 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
----------------
clementval wrote:

`lookupFuncOp` only look for `llvm.func` and the problem is that a `func.func` not converted yet is not considered. This check here look for conflicting symbols (not just `llvm.func`) so we will not create a duplicate. 

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


More information about the Mlir-commits mailing list