[mlir]Moves the StateStack to IR folder from Support folder. (#145598)

[MLIR] Fix circular dependency introduced in In
https://github.com/llvm/llvm-project/pull/144897. This PR is to break
the dependency. by moving StateStack to IR folder

This commit resolves a circular dependency issue between mlir/Support
and mlir/IR:

- Move StateStack.h and StateStack.cpp from Support to IR folder
- Update CMakeLists.txt files to reflect the new locations
- Update Bazel BUILD file to maintain correct dependencies
- Update includes in affected files (flang, Target/LLVMIR)

The circular dependency was caused by StateStack.h depending on
IR/Visitors.h
while other IR files depended on Support. Moving StateStack to IR
eliminates
this cycle while maintaining proper separation of concerns.
This commit is contained in:
Lance Wang
2025-06-24 21:00:13 -07:00
committed by GitHub
parent 505906bff6
commit 77af8bff97
8 changed files with 9 additions and 13 deletions

View File

@@ -68,8 +68,8 @@
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/StateStack.h"
#include "mlir/Parser/Parser.h"
#include "mlir/Support/StateStack.h"
#include "mlir/Transforms/RegionUtils.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringSet.h"

View File

@@ -39,7 +39,7 @@
#include "flang/Support/OpenMP-utils.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
#include "mlir/Support/StateStack.h"
#include "mlir/IR/StateStack.h"
#include "mlir/Transforms/RegionUtils.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Frontend/OpenMP/OMPConstants.h"

View File

@@ -12,8 +12,8 @@
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_SUPPORT_STACKFRAME_H
#define MLIR_SUPPORT_STACKFRAME_H
#ifndef MLIR_IR_STACKFRAME_H
#define MLIR_IR_STACKFRAME_H
#include "mlir/IR/Visitors.h"
#include "mlir/Support/TypeID.h"
@@ -125,4 +125,4 @@ struct isa_impl<T, ::mlir::StateStackFrame> {
};
} // namespace llvm
#endif // MLIR_SUPPORT_STACKFRAME_H
#endif // MLIR_IR_STACKFRAME_H

View File

@@ -16,9 +16,9 @@
#include "mlir/Dialect/LLVMIR/LLVMInterfaces.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/StateStack.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/IR/Value.h"
#include "mlir/Support/StateStack.h"
#include "mlir/Target/LLVMIR/Export.h"
#include "mlir/Target/LLVMIR/LLVMTranslationInterface.h"
#include "mlir/Target/LLVMIR/TypeToLLVM.h"

View File

@@ -32,6 +32,7 @@ add_mlir_library(MLIRIR
PatternMatch.cpp
Region.cpp
RegionKindInterface.cpp
StateStack.cpp
SymbolTable.cpp
TensorEncoding.cpp
Types.cpp

View File

@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
#include "mlir/Support/StateStack.h"
#include "mlir/IR/StateStack.h"
namespace mlir {

View File

@@ -11,7 +11,6 @@ add_mlir_library(MLIRSupport
FileUtilities.cpp
InterfaceSupport.cpp
RawOstreamExtras.cpp
StateStack.cpp
StorageUniquer.cpp
Timing.cpp
ToolUtilities.cpp

View File

@@ -4845,11 +4845,7 @@ cc_library(
]),
hdrs = glob(["include/mlir/Support/*.h"]),
includes = ["include"],
deps = [
"//llvm:Support",
"//mlir:IR",
],
)
deps = ["//llvm:Support"],)
cc_library(
name = "Debug",