[llvm] [mlir] [Utils][mlir] Fix interaction between CodeExtractor and OpenMPIRBuilder (PR #145051)

Kajetan Puchalski via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 23 05:05:55 PDT 2025


================
@@ -2332,6 +2332,10 @@ mlir::translateModuleToLLVMIR(Operation *module, llvm::LLVMContext &llvmContext,
   // beforehand.
   translator.debugTranslation->addModuleFlagsIfNotPresent();
 
+  // Call the OpenMP IR Builder callbacks prior to verifying the module
+  if (auto *ompBuilder = translator.getOpenMPBuilder())
+    ompBuilder->finalize();
+
   if (!disableVerification &&
       llvm::verifyModule(*translator.llvmModule, &llvm::errs()))
     return nullptr;
----------------
mrkajetanp wrote:

We could do this, but then we'd have to change the signature of `mlir::translateModuleToLLVMIR` to remove the `disableVerification` option as it would no longer be possible to run the translation without verification, because verification would always happen in the destructor. Is this desirable?

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


More information about the llvm-commits mailing list