[llvm] [KernelInfo] Implement new LLVM IR pass for GPU code analysis (PR #102944)
Jorge Gorbe Moya via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 29 10:50:43 PST 2025
slackito wrote:
I was trying to fix the bazel build after this change, and it seems it introduces a couple of circular dependencies. `Analysis/KernelInfo.cpp` includes `Passes/PassBuilder.h` and `Target/TargetMachine.h`, but both `Passes` and `Target` already depend on `Analysis`.
I think the circular dependency can be broken by removing the PassBuilder.h include, which seems to be unused, and replacing the TargetMachine include with a forward decl. Something like this:
```
diff --git a/llvm/lib/Analysis/KernelInfo.cpp b/llvm/lib/Analysis/KernelInfo.cpp
index be9b1136321f..5175614645bf 100644
--- a/llvm/lib/Analysis/KernelInfo.cpp
+++ b/llvm/lib/Analysis/KernelInfo.cpp
@@ -15,17 +15,20 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
+#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
-#include "llvm/Passes/PassBuilder.h"
-#include "llvm/Target/TargetMachine.h"
using namespace llvm;
+namespace llvm {
+class TargetMachine;
+}
+
#define DEBUG_TYPE "kernel-info"
namespace {
```
https://github.com/llvm/llvm-project/pull/102944
More information about the llvm-commits
mailing list