[Mlir-commits] [mlir] [mlir][Func] Extract operation-to-function utility from Query (PR #174103)

Nick Kreeger llvmlistbot at llvm.org
Sun Jan 18 10:22:05 PST 2026


================
@@ -318,3 +318,65 @@ func::lookupOrCreateFnDecl(OpBuilder &b, SymbolOpInterface symTable,
   return createFnDecl(b, symTable, funcName, funcT,
                       /*setPrivate=*/true, symbolTables);
 }
+
+func::FuncOp func::extractOperationsIntoFunction(ArrayRef<Operation *> ops,
+                                                 MLIRContext *context,
+                                                 StringRef functionName) {
+  context->loadDialect<func::FuncDialect>();
----------------
nkreeger wrote:

I moved the loadDialect call from `extractOperationsIntoFunction` to the call site in Query.cpp - this makes `extractOperationsIntoFunction` safe to call from passes where the context is multithreaded.

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


More information about the Mlir-commits mailing list