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

Kareem Ergawy via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 23 02:28:30 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;
----------------
ergawy wrote:

I think we can move module verification to `~ModuleTranslation` instead. This way we both make sure that verification happens after finalization and we do not need to add the `isFinalized` bool.

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


More information about the llvm-commits mailing list