[Mlir-commits] [mlir] [MLIR] Avoid #include OMPIRBuilder.h (PR #151302)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Jul 30 02:58:17 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-llvm
Author: Michael Kruse (Meinersbur)
<details>
<summary>Changes</summary>
`#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"` can be replaced with forward-declarations of `OpenMPIRBuilder` and `CanonicalLoopInfo`. This also avoids a dependency to `omp_gen` of the LLVMFrontendOpenMP component which is included indirectly in `OMPIRBuilder.h`.
Since its inclusion in #<!-- -->147069, additional indirect dependencies on headers included by `OMPIRBuilder.h` were introduced as well. These are now included directly.
Reported-by: [fabrizio-indirli](https://github.com/fabrizio-indirli)
See https://github.com/llvm/llvm-project/pull/147069#issuecomment-3114034973
---
Full diff: https://github.com/llvm/llvm-project/pull/151302.diff
2 Files Affected:
- (modified) mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h (+2-1)
- (modified) mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp (+1)
``````````diff
diff --git a/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h b/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h
index f3f73f49f199a..f0bd5245a7d41 100644
--- a/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h
+++ b/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h
@@ -25,11 +25,12 @@
#include "mlir/Target/LLVMIR/TypeToLLVM.h"
#include "llvm/ADT/SetVector.h"
-#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
#include "llvm/IR/FPEnv.h"
+#include "llvm/IR/Module.h"
namespace llvm {
class BasicBlock;
+class CanonicalLoopInfo;
class Function;
class IRBuilderBase;
class OpenMPIRBuilder;
diff --git a/mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
index cffe310c468c4..52cd0cec0c800 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
@@ -30,6 +30,7 @@
#include "mlir/IR/Types.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/TypeSwitch.h"
+#include "llvm/IR/IRBuilder.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/raw_ostream.h"
``````````
</details>
https://github.com/llvm/llvm-project/pull/151302
More information about the Mlir-commits
mailing list