[Mlir-commits] [mlir] [MLIR] Avoid #include OMPIRBuilder.h (PR #151302)
Michael Kruse
llvmlistbot at llvm.org
Wed Jul 30 02:57:43 PDT 2025
https://github.com/Meinersbur created https://github.com/llvm/llvm-project/pull/151302
`#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
>From aba388ff718dcfff6214801c4411ad110ed4a1ad Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Wed, 30 Jul 2025 11:48:28 +0200
Subject: [PATCH] [MLIR] Avoid #include OMPIRBuilder.h
---
mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h | 3 ++-
mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
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"
More information about the Mlir-commits
mailing list