Skip to content

Commit 77af8bf

Browse files
authored
[mlir]Moves the StateStack to IR folder from Support folder. (#145598)
[MLIR] Fix circular dependency introduced in In #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.
1 parent 505906b commit 77af8bf

File tree

8 files changed

+9
-13
lines changed

8 files changed

+9
-13
lines changed

flang/lib/Lower/Bridge.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@
6868
#include "mlir/IR/BuiltinAttributes.h"
6969
#include "mlir/IR/Matchers.h"
7070
#include "mlir/IR/PatternMatch.h"
71+
#include "mlir/IR/StateStack.h"
7172
#include "mlir/Parser/Parser.h"
72-
#include "mlir/Support/StateStack.h"
7373
#include "mlir/Transforms/RegionUtils.h"
7474
#include "llvm/ADT/SmallVector.h"
7575
#include "llvm/ADT/StringSet.h"

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include "flang/Support/OpenMP-utils.h"
4040
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
4141
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
42-
#include "mlir/Support/StateStack.h"
42+
#include "mlir/IR/StateStack.h"
4343
#include "mlir/Transforms/RegionUtils.h"
4444
#include "llvm/ADT/STLExtras.h"
4545
#include "llvm/Frontend/OpenMP/OMPConstants.h"

mlir/include/mlir/Support/StateStack.h renamed to mlir/include/mlir/IR/StateStack.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#ifndef MLIR_SUPPORT_STACKFRAME_H
16-
#define MLIR_SUPPORT_STACKFRAME_H
15+
#ifndef MLIR_IR_STACKFRAME_H
16+
#define MLIR_IR_STACKFRAME_H
1717

1818
#include "mlir/IR/Visitors.h"
1919
#include "mlir/Support/TypeID.h"
@@ -125,4 +125,4 @@ struct isa_impl<T, ::mlir::StateStackFrame> {
125125
};
126126
} // namespace llvm
127127

128-
#endif // MLIR_SUPPORT_STACKFRAME_H
128+
#endif // MLIR_IR_STACKFRAME_H

mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
#include "mlir/Dialect/LLVMIR/LLVMInterfaces.h"
1818
#include "mlir/IR/Operation.h"
19+
#include "mlir/IR/StateStack.h"
1920
#include "mlir/IR/SymbolTable.h"
2021
#include "mlir/IR/Value.h"
21-
#include "mlir/Support/StateStack.h"
2222
#include "mlir/Target/LLVMIR/Export.h"
2323
#include "mlir/Target/LLVMIR/LLVMTranslationInterface.h"
2424
#include "mlir/Target/LLVMIR/TypeToLLVM.h"

mlir/lib/IR/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ add_mlir_library(MLIRIR
3232
PatternMatch.cpp
3333
Region.cpp
3434
RegionKindInterface.cpp
35+
StateStack.cpp
3536
SymbolTable.cpp
3637
TensorEncoding.cpp
3738
Types.cpp

mlir/lib/Support/StateStack.cpp renamed to mlir/lib/IR/StateStack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "mlir/Support/StateStack.h"
9+
#include "mlir/IR/StateStack.h"
1010

1111
namespace mlir {
1212

mlir/lib/Support/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ add_mlir_library(MLIRSupport
1111
FileUtilities.cpp
1212
InterfaceSupport.cpp
1313
RawOstreamExtras.cpp
14-
StateStack.cpp
1514
StorageUniquer.cpp
1615
Timing.cpp
1716
ToolUtilities.cpp

utils/bazel/llvm-project-overlay/mlir/BUILD.bazel

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4845,11 +4845,7 @@ cc_library(
48454845
]),
48464846
hdrs = glob(["include/mlir/Support/*.h"]),
48474847
includes = ["include"],
4848-
deps = [
4849-
"//llvm:Support",
4850-
"//mlir:IR",
4851-
],
4852-
)
4848+
deps = ["//llvm:Support"],)
48534849

48544850
cc_library(
48554851
name = "Debug",

0 commit comments

Comments
 (0)