[Mlir-commits] [mlir] 755dc07 - [mlir:Analysis] Move the LoopAnalysis library to Dialect/Affine/Analysis
River Riddle
llvmlistbot at llvm.org
Tue Jan 18 10:28:32 PST 2022
Author: River Riddle
Date: 2022-01-18T10:28:22-08:00
New Revision: 755dc07d69ed5c3a4a5ef6a2de68aa10378891a0
URL: https://github.com/llvm/llvm-project/commit/755dc07d69ed5c3a4a5ef6a2de68aa10378891a0
DIFF: https://github.com/llvm/llvm-project/commit/755dc07d69ed5c3a4a5ef6a2de68aa10378891a0.diff
LOG: [mlir:Analysis] Move the LoopAnalysis library to Dialect/Affine/Analysis
The current state of the top level Analysis/ directory is that it contains two libraries;
a generic Analysis library (free from dialect dependencies), and a LoopAnalysis library
that contains various analysis utilities that originated from Affine loop transformations.
This commit moves the LoopAnalysis to the more appropriate home of `Dialect/Affine/Analysis/`,
given the use and intention of the majority of the code within it. After the move, if there
are generic utilities that would fit better in the top-level Analysis/ directory, we can move
them.
Differential Revision: https://reviews.llvm.org/D117351
Added:
mlir/include/mlir/Dialect/Affine/Analysis/AffineAnalysis.h
mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h
mlir/include/mlir/Dialect/Affine/Analysis/LoopAnalysis.h
mlir/include/mlir/Dialect/Affine/Analysis/NestedMatcher.h
mlir/include/mlir/Dialect/Affine/Analysis/Utils.h
mlir/lib/Dialect/Affine/Analysis/AffineAnalysis.cpp
mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
mlir/lib/Dialect/Affine/Analysis/CMakeLists.txt
mlir/lib/Dialect/Affine/Analysis/LoopAnalysis.cpp
mlir/lib/Dialect/Affine/Analysis/NestedMatcher.cpp
mlir/lib/Dialect/Affine/Analysis/Utils.cpp
mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParser.cpp
mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParser.h
mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParserTest.cpp
mlir/unittests/Dialect/Affine/Analysis/CMakeLists.txt
mlir/unittests/Dialect/Affine/CMakeLists.txt
Modified:
mlir/include/mlir/Analysis/SliceAnalysis.h
mlir/include/mlir/Dialect/Affine/Utils.h
mlir/lib/Analysis/CMakeLists.txt
mlir/lib/Analysis/SliceAnalysis.cpp
mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp
mlir/lib/Dialect/Affine/CMakeLists.txt
mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp
mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
mlir/lib/Dialect/Affine/Transforms/AffineParallelize.cpp
mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp
mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp
mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp
mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
mlir/lib/Dialect/Affine/Utils/Utils.cpp
mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
mlir/lib/Dialect/Linalg/Utils/Utils.cpp
mlir/lib/Dialect/SCF/Transforms/AffineCanonicalizationUtils.cpp
mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
mlir/lib/Dialect/Vector/CMakeLists.txt
mlir/lib/Dialect/Vector/VectorUtils.cpp
mlir/lib/Transforms/LoopFusion.cpp
mlir/lib/Transforms/PipelineDataTransfer.cpp
mlir/lib/Transforms/Utils/CMakeLists.txt
mlir/lib/Transforms/Utils/LoopFusionUtils.cpp
mlir/lib/Transforms/Utils/LoopUtils.cpp
mlir/lib/Transforms/Utils/Utils.cpp
mlir/test/lib/Analysis/TestMatchReduction.cpp
mlir/test/lib/Analysis/TestMemRefBoundCheck.cpp
mlir/test/lib/Analysis/TestMemRefDependenceCheck.cpp
mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp
mlir/test/lib/Dialect/Affine/TestAffineLoopUnswitching.cpp
mlir/test/lib/Dialect/Affine/TestLoopPermutation.cpp
mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp
mlir/test/lib/Transforms/TestLoopFusion.cpp
mlir/tools/mlir-lsp-server/CMakeLists.txt
mlir/tools/mlir-opt/CMakeLists.txt
mlir/unittests/Analysis/CMakeLists.txt
mlir/unittests/Analysis/Presburger/CMakeLists.txt
mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
mlir/unittests/Analysis/Presburger/PresburgerSetTest.cpp
mlir/unittests/Analysis/Presburger/SimplexTest.cpp
mlir/unittests/Dialect/CMakeLists.txt
Removed:
mlir/include/mlir/Analysis/AffineAnalysis.h
mlir/include/mlir/Analysis/AffineStructures.h
mlir/include/mlir/Analysis/LoopAnalysis.h
mlir/include/mlir/Analysis/NestedMatcher.h
mlir/include/mlir/Analysis/Utils.h
mlir/lib/Analysis/AffineAnalysis.cpp
mlir/lib/Analysis/AffineStructures.cpp
mlir/lib/Analysis/LoopAnalysis.cpp
mlir/lib/Analysis/NestedMatcher.cpp
mlir/lib/Analysis/Utils.cpp
mlir/unittests/Analysis/AffineStructuresParser.cpp
mlir/unittests/Analysis/AffineStructuresParser.h
mlir/unittests/Analysis/AffineStructuresParserTest.cpp
################################################################################
diff --git a/mlir/include/mlir/Analysis/SliceAnalysis.h b/mlir/include/mlir/Analysis/SliceAnalysis.h
index fa5409260c427..a6776a67d9606 100644
--- a/mlir/include/mlir/Analysis/SliceAnalysis.h
+++ b/mlir/include/mlir/Analysis/SliceAnalysis.h
@@ -17,7 +17,7 @@
#include "llvm/ADT/SetVector.h"
namespace mlir {
-
+class BlockArgument;
class Operation;
class Value;
@@ -205,6 +205,37 @@ getSlice(Operation *op,
/// Returns a topologically sorted SetVector.
SetVector<Operation *> topologicalSort(const SetVector<Operation *> &toSort);
+/// Utility to match a generic reduction given a list of iteration-carried
+/// arguments, `iterCarriedArgs` and the position of the potential reduction
+/// argument within the list, `redPos`. If a reduction is matched, returns the
+/// reduced value and the topologically-sorted list of combiner operations
+/// involved in the reduction. Otherwise, returns a null value.
+///
+/// The matching algorithm relies on the following invariants, which are subject
+/// to change:
+/// 1. The first combiner operation must be a binary operation with the
+/// iteration-carried value and the reduced value as operands.
+/// 2. The iteration-carried value and combiner operations must be side
+/// effect-free, have single result and a single use.
+/// 3. Combiner operations must be immediately nested in the region op
+/// performing the reduction.
+/// 4. Reduction def-use chain must end in a terminator op that yields the
+/// next iteration/output values in the same order as the iteration-carried
+/// values in `iterCarriedArgs`.
+/// 5. `iterCarriedArgs` must contain all the iteration-carried/output values
+/// of the region op performing the reduction.
+///
+/// This utility is generic enough to detect reductions involving multiple
+/// combiner operations (disabled for now) across multiple dialects, including
+/// Linalg, Affine and SCF. For the sake of genericity, it does not return
+/// specific enum values for the combiner operations since its goal is also
+/// matching reductions without pre-defined semantics in core MLIR. It's up to
+/// each client to make sense out of the list of combiner operations. It's also
+/// up to each client to check for additional invariants on the expected
+/// reductions not covered by this generic matching.
+Value matchReduction(ArrayRef<BlockArgument> iterCarriedArgs, unsigned redPos,
+ SmallVectorImpl<Operation *> &combinerOps);
+
} // namespace mlir
#endif // MLIR_ANALYSIS_SLICEANALYSIS_H_
diff --git a/mlir/include/mlir/Analysis/AffineAnalysis.h b/mlir/include/mlir/Dialect/Affine/Analysis/AffineAnalysis.h
similarity index 97%
rename from mlir/include/mlir/Analysis/AffineAnalysis.h
rename to mlir/include/mlir/Dialect/Affine/Analysis/AffineAnalysis.h
index ff0f99a1e5939..872b1f8743955 100644
--- a/mlir/include/mlir/Analysis/AffineAnalysis.h
+++ b/mlir/include/mlir/Dialect/Affine/Analysis/AffineAnalysis.h
@@ -12,8 +12,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef MLIR_ANALYSIS_AFFINEANALYSIS_H
-#define MLIR_ANALYSIS_AFFINEANALYSIS_H
+#ifndef MLIR_DIALECT_AFFINE_ANALYSIS_AFFINEANALYSIS_H
+#define MLIR_DIALECT_AFFINE_ANALYSIS_AFFINEANALYSIS_H
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
@@ -185,4 +185,4 @@ void getDependenceComponents(
} // namespace mlir
-#endif // MLIR_ANALYSIS_AFFINEANALYSIS_H
+#endif // MLIR_DIALECT_AFFINE_ANALYSIS_AFFINEANALYSIS_H
diff --git a/mlir/include/mlir/Analysis/AffineStructures.h b/mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h
similarity index 99%
rename from mlir/include/mlir/Analysis/AffineStructures.h
rename to mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h
index 1bcafe24ca2aa..e53dc74e73eb3 100644
--- a/mlir/include/mlir/Analysis/AffineStructures.h
+++ b/mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h
@@ -10,8 +10,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef MLIR_ANALYSIS_AFFINESTRUCTURES_H
-#define MLIR_ANALYSIS_AFFINESTRUCTURES_H
+#ifndef MLIR_DIALECT_AFFINE_ANALYSIS_AFFINESTRUCTURES_H
+#define MLIR_DIALECT_AFFINE_ANALYSIS_AFFINESTRUCTURES_H
#include "mlir/Analysis/Presburger/IntegerPolyhedron.h"
#include "mlir/Analysis/Presburger/Matrix.h"
@@ -694,4 +694,4 @@ LogicalResult getRelationFromMap(const AffineValueMap &map,
} // namespace mlir.
-#endif // MLIR_ANALYSIS_AFFINESTRUCTURES_H
+#endif // MLIR_DIALECT_AFFINE_ANALYSIS_AFFINESTRUCTURES_H
diff --git a/mlir/include/mlir/Analysis/LoopAnalysis.h b/mlir/include/mlir/Dialect/Affine/Analysis/LoopAnalysis.h
similarity index 64%
rename from mlir/include/mlir/Analysis/LoopAnalysis.h
rename to mlir/include/mlir/Dialect/Affine/Analysis/LoopAnalysis.h
index b3274356f4d48..c1fd24fd79dab 100644
--- a/mlir/include/mlir/Analysis/LoopAnalysis.h
+++ b/mlir/include/mlir/Dialect/Affine/Analysis/LoopAnalysis.h
@@ -10,8 +10,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef MLIR_ANALYSIS_LOOPANALYSIS_H
-#define MLIR_ANALYSIS_LOOPANALYSIS_H
+#ifndef MLIR_DIALECT_AFFINE_ANALYSIS_LOOPANALYSIS_H
+#define MLIR_DIALECT_AFFINE_ANALYSIS_LOOPANALYSIS_H
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/ArrayRef.h"
@@ -83,36 +83,6 @@ bool isVectorizableLoopBody(AffineForOp loop, int *memRefDim,
// the support.
bool isOpwiseShiftValid(AffineForOp forOp, ArrayRef<uint64_t> shifts);
-/// Utility to match a generic reduction given a list of iteration-carried
-/// arguments, `iterCarriedArgs` and the position of the potential reduction
-/// argument within the list, `redPos`. If a reduction is matched, returns the
-/// reduced value and the topologically-sorted list of combiner operations
-/// involved in the reduction. Otherwise, returns a null value.
-///
-/// The matching algorithm relies on the following invariants, which are subject
-/// to change:
-/// 1. The first combiner operation must be a binary operation with the
-/// iteration-carried value and the reduced value as operands.
-/// 2. The iteration-carried value and combiner operations must be side
-/// effect-free, have single result and a single use.
-/// 3. Combiner operations must be immediately nested in the region op
-/// performing the reduction.
-/// 4. Reduction def-use chain must end in a terminator op that yields the
-/// next iteration/output values in the same order as the iteration-carried
-/// values in `iterCarriedArgs`.
-/// 5. `iterCarriedArgs` must contain all the iteration-carried/output values
-/// of the region op performing the reduction.
-///
-/// This utility is generic enough to detect reductions involving multiple
-/// combiner operations (disabled for now) across multiple dialects, including
-/// Linalg, Affine and SCF. For the sake of genericity, it does not return
-/// specific enum values for the combiner operations since its goal is also
-/// matching reductions without pre-defined semantics in core MLIR. It's up to
-/// each client to make sense out of the list of combiner operations. It's also
-/// up to each client to check for additional invariants on the expected
-/// reductions not covered by this generic matching.
-Value matchReduction(ArrayRef<BlockArgument> iterCarriedArgs, unsigned redPos,
- SmallVectorImpl<Operation *> &combinerOps);
} // namespace mlir
-#endif // MLIR_ANALYSIS_LOOPANALYSIS_H
+#endif // MLIR_DIALECT_AFFINE_ANALYSIS_LOOPANALYSIS_H
diff --git a/mlir/include/mlir/Analysis/NestedMatcher.h b/mlir/include/mlir/Dialect/Affine/Analysis/NestedMatcher.h
similarity index 97%
rename from mlir/include/mlir/Analysis/NestedMatcher.h
rename to mlir/include/mlir/Dialect/Affine/Analysis/NestedMatcher.h
index 1c8d318d7d94c..18e29567afb00 100644
--- a/mlir/include/mlir/Analysis/NestedMatcher.h
+++ b/mlir/include/mlir/Dialect/Affine/Analysis/NestedMatcher.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef MLIR_ANALYSIS_NESTEDMATCHER_H
-#define MLIR_ANALYSIS_NESTEDMATCHER_H
+#ifndef MLIR_DIALECT_AFFINE_ANALYSIS_NESTEDMATCHER_H
+#define MLIR_DIALECT_AFFINE_ANALYSIS_NESTEDMATCHER_H
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Operation.h"
@@ -198,4 +198,4 @@ bool isLoadOrStore(Operation &op);
} // namespace matcher
} // namespace mlir
-#endif // MLIR_ANALYSIS_NESTEDMATCHER_H
+#endif // MLIR_DIALECT_AFFINE_ANALYSIS_NESTEDMATCHER_H
diff --git a/mlir/include/mlir/Analysis/Utils.h b/mlir/include/mlir/Dialect/Affine/Analysis/Utils.h
similarity index 98%
rename from mlir/include/mlir/Analysis/Utils.h
rename to mlir/include/mlir/Dialect/Affine/Analysis/Utils.h
index fb586af7d7d56..1a25eaffedd0d 100644
--- a/mlir/include/mlir/Analysis/Utils.h
+++ b/mlir/include/mlir/Dialect/Affine/Analysis/Utils.h
@@ -13,10 +13,10 @@
//
//===----------------------------------------------------------------------===//
-#ifndef MLIR_ANALYSIS_UTILS_H
-#define MLIR_ANALYSIS_UTILS_H
+#ifndef MLIR_DIALECT_AFFINE_ANALYSIS_UTILS_H
+#define MLIR_DIALECT_AFFINE_ANALYSIS_UTILS_H
-#include "mlir/Analysis/AffineStructures.h"
+#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Block.h"
#include "mlir/IR/Location.h"
@@ -382,4 +382,4 @@ unsigned getInnermostCommonLoopDepth(
} // namespace mlir
-#endif // MLIR_ANALYSIS_UTILS_H
+#endif // MLIR_DIALECT_AFFINE_ANALYSIS_UTILS_H
diff --git a/mlir/include/mlir/Dialect/Affine/Utils.h b/mlir/include/mlir/Dialect/Affine/Utils.h
index 066ff3c3b3635..a0cb63d7fb9e5 100644
--- a/mlir/include/mlir/Dialect/Affine/Utils.h
+++ b/mlir/include/mlir/Dialect/Affine/Utils.h
@@ -13,7 +13,7 @@
#ifndef MLIR_DIALECT_AFFINE_UTILS_H
#define MLIR_DIALECT_AFFINE_UTILS_H
-#include "mlir/Analysis/AffineAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
namespace mlir {
diff --git a/mlir/lib/Analysis/CMakeLists.txt b/mlir/lib/Analysis/CMakeLists.txt
index 7c9a71237adfd..29314ed535931 100644
--- a/mlir/lib/Analysis/CMakeLists.txt
+++ b/mlir/lib/Analysis/CMakeLists.txt
@@ -1,16 +1,11 @@
set(LLVM_OPTIONAL_SOURCES
AliasAnalysis.cpp
- AffineAnalysis.cpp
- AffineStructures.cpp
BufferViewFlowAnalysis.cpp
CallGraph.cpp
DataFlowAnalysis.cpp
DataLayoutAnalysis.cpp
Liveness.cpp
- LoopAnalysis.cpp
- NestedMatcher.cpp
SliceAnalysis.cpp
- Utils.cpp
AliasAnalysis/LocalAliasAnalysis.cpp
)
@@ -41,27 +36,4 @@ add_mlir_library(MLIRAnalysis
MLIRViewLikeInterface
)
-add_mlir_library(MLIRLoopAnalysis
- AffineAnalysis.cpp
- AffineStructures.cpp
- LoopAnalysis.cpp
- NestedMatcher.cpp
- Utils.cpp
-
- ADDITIONAL_HEADER_DIRS
- ${MLIR_MAIN_INCLUDE_DIR}/mlir/Analysis
-
- DEPENDS
- mlir-headers
-
- LINK_LIBS PUBLIC
- MLIRAffine
- MLIRAnalysis
- MLIRCallInterfaces
- MLIRControlFlowInterfaces
- MLIRInferTypeOpInterface
- MLIRPresburger
- MLIRSCF
- )
-
add_subdirectory(Presburger)
diff --git a/mlir/lib/Analysis/SliceAnalysis.cpp b/mlir/lib/Analysis/SliceAnalysis.cpp
index fa78a804175dd..6a1d39786199f 100644
--- a/mlir/lib/Analysis/SliceAnalysis.cpp
+++ b/mlir/lib/Analysis/SliceAnalysis.cpp
@@ -15,6 +15,7 @@
#include "mlir/IR/Operation.h"
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/SetVector.h"
+#include "llvm/ADT/SmallPtrSet.h"
///
/// Implements Analysis functions specific to slicing in Function.
@@ -212,3 +213,105 @@ mlir::topologicalSort(const SetVector<Operation *> &toSort) {
}
return res;
}
+
+/// Returns true if `value` (transitively) depends on iteration-carried values
+/// of the given `ancestorOp`.
+static bool dependsOnCarriedVals(Value value,
+ ArrayRef<BlockArgument> iterCarriedArgs,
+ Operation *ancestorOp) {
+ // Compute the backward slice of the value.
+ SetVector<Operation *> slice;
+ getBackwardSlice(value, &slice,
+ [&](Operation *op) { return !ancestorOp->isAncestor(op); });
+
+ // Check that none of the operands of the operations in the backward slice are
+ // loop iteration arguments, and neither is the value itself.
+ SmallPtrSet<Value, 8> iterCarriedValSet(iterCarriedArgs.begin(),
+ iterCarriedArgs.end());
+ if (iterCarriedValSet.contains(value))
+ return true;
+
+ for (Operation *op : slice)
+ for (Value operand : op->getOperands())
+ if (iterCarriedValSet.contains(operand))
+ return true;
+
+ return false;
+}
+
+/// Utility to match a generic reduction given a list of iteration-carried
+/// arguments, `iterCarriedArgs` and the position of the potential reduction
+/// argument within the list, `redPos`. If a reduction is matched, returns the
+/// reduced value and the topologically-sorted list of combiner operations
+/// involved in the reduction. Otherwise, returns a null value.
+///
+/// The matching algorithm relies on the following invariants, which are subject
+/// to change:
+/// 1. The first combiner operation must be a binary operation with the
+/// iteration-carried value and the reduced value as operands.
+/// 2. The iteration-carried value and combiner operations must be side
+/// effect-free, have single result and a single use.
+/// 3. Combiner operations must be immediately nested in the region op
+/// performing the reduction.
+/// 4. Reduction def-use chain must end in a terminator op that yields the
+/// next iteration/output values in the same order as the iteration-carried
+/// values in `iterCarriedArgs`.
+/// 5. `iterCarriedArgs` must contain all the iteration-carried/output values
+/// of the region op performing the reduction.
+///
+/// This utility is generic enough to detect reductions involving multiple
+/// combiner operations (disabled for now) across multiple dialects, including
+/// Linalg, Affine and SCF. For the sake of genericity, it does not return
+/// specific enum values for the combiner operations since its goal is also
+/// matching reductions without pre-defined semantics in core MLIR. It's up to
+/// each client to make sense out of the list of combiner operations. It's also
+/// up to each client to check for additional invariants on the expected
+/// reductions not covered by this generic matching.
+Value mlir::matchReduction(ArrayRef<BlockArgument> iterCarriedArgs,
+ unsigned redPos,
+ SmallVectorImpl<Operation *> &combinerOps) {
+ assert(redPos < iterCarriedArgs.size() && "'redPos' is out of bounds");
+
+ BlockArgument redCarriedVal = iterCarriedArgs[redPos];
+ if (!redCarriedVal.hasOneUse())
+ return nullptr;
+
+ // For now, the first combiner op must be a binary op.
+ Operation *combinerOp = *redCarriedVal.getUsers().begin();
+ if (combinerOp->getNumOperands() != 2)
+ return nullptr;
+ Value reducedVal = combinerOp->getOperand(0) == redCarriedVal
+ ? combinerOp->getOperand(1)
+ : combinerOp->getOperand(0);
+
+ Operation *redRegionOp =
+ iterCarriedArgs.front().getOwner()->getParent()->getParentOp();
+ if (dependsOnCarriedVals(reducedVal, iterCarriedArgs, redRegionOp))
+ return nullptr;
+
+ // Traverse the def-use chain starting from the first combiner op until a
+ // terminator is found. Gather all the combiner ops along the way in
+ // topological order.
+ while (!combinerOp->mightHaveTrait<OpTrait::IsTerminator>()) {
+ if (!MemoryEffectOpInterface::hasNoEffect(combinerOp) ||
+ combinerOp->getNumResults() != 1 || !combinerOp->hasOneUse() ||
+ combinerOp->getParentOp() != redRegionOp)
+ return nullptr;
+
+ combinerOps.push_back(combinerOp);
+ combinerOp = *combinerOp->getUsers().begin();
+ }
+
+ // Limit matching to single combiner op until we can properly test reductions
+ // involving multiple combiners.
+ if (combinerOps.size() != 1)
+ return nullptr;
+
+ // Check that the yielded value is in the same position as in
+ // `iterCarriedArgs`.
+ Operation *terminatorOp = combinerOp;
+ if (terminatorOp->getOperand(redPos) != combinerOps.back()->getResults()[0])
+ return nullptr;
+
+ return reducedVal;
+}
diff --git a/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp b/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp
index 16fbb3ec6807e..14ac92e07c47a 100644
--- a/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp
+++ b/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp
@@ -13,7 +13,8 @@
#include "mlir/Conversion/SCFToOpenMP/SCFToOpenMP.h"
#include "../PassDetail.h"
-#include "mlir/Analysis/LoopAnalysis.h"
+#include "mlir/Analysis/SliceAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
diff --git a/mlir/lib/Analysis/AffineAnalysis.cpp b/mlir/lib/Dialect/Affine/Analysis/AffineAnalysis.cpp
similarity index 99%
rename from mlir/lib/Analysis/AffineAnalysis.cpp
rename to mlir/lib/Dialect/Affine/Analysis/AffineAnalysis.cpp
index 9f976a63c1453..01e623f3d8ac9 100644
--- a/mlir/lib/Analysis/AffineAnalysis.cpp
+++ b/mlir/lib/Dialect/Affine/Analysis/AffineAnalysis.cpp
@@ -11,10 +11,10 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/LoopAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
#include "mlir/Analysis/SliceAnalysis.h"
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
diff --git a/mlir/lib/Analysis/AffineStructures.cpp b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
similarity index 99%
rename from mlir/lib/Analysis/AffineStructures.cpp
rename to mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
index 0e25c640e1b0e..ead0f22f14c1e 100644
--- a/mlir/lib/Analysis/AffineStructures.cpp
+++ b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
@@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Analysis/AffineStructures.h"
+#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
#include "mlir/Analysis/Presburger/LinearTransform.h"
#include "mlir/Analysis/Presburger/Simplex.h"
#include "mlir/Analysis/Presburger/Utils.h"
diff --git a/mlir/lib/Dialect/Affine/Analysis/CMakeLists.txt b/mlir/lib/Dialect/Affine/Analysis/CMakeLists.txt
new file mode 100644
index 0000000000000..c2b277120236b
--- /dev/null
+++ b/mlir/lib/Dialect/Affine/Analysis/CMakeLists.txt
@@ -0,0 +1,22 @@
+add_mlir_dialect_library(MLIRAffineAnalysis
+ AffineAnalysis.cpp
+ AffineStructures.cpp
+ LoopAnalysis.cpp
+ NestedMatcher.cpp
+ Utils.cpp
+
+ ADDITIONAL_HEADER_DIRS
+ ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Affine
+
+ DEPENDS
+ mlir-headers
+
+ LINK_LIBS PUBLIC
+ MLIRAffine
+ MLIRAnalysis
+ MLIRCallInterfaces
+ MLIRControlFlowInterfaces
+ MLIRInferTypeOpInterface
+ MLIRPresburger
+ MLIRSCF
+ )
diff --git a/mlir/lib/Analysis/LoopAnalysis.cpp b/mlir/lib/Dialect/Affine/Analysis/LoopAnalysis.cpp
similarity index 75%
rename from mlir/lib/Analysis/LoopAnalysis.cpp
rename to mlir/lib/Dialect/Affine/Analysis/LoopAnalysis.cpp
index 914bc1604d391..0620a593d2063 100644
--- a/mlir/lib/Analysis/LoopAnalysis.cpp
+++ b/mlir/lib/Dialect/Affine/Analysis/LoopAnalysis.cpp
@@ -10,12 +10,12 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Analysis/LoopAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
-#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/AffineStructures.h"
-#include "mlir/Analysis/NestedMatcher.h"
#include "mlir/Analysis/SliceAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
+#include "mlir/Dialect/Affine/Analysis/NestedMatcher.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Support/MathExtras.h"
@@ -381,105 +381,3 @@ bool mlir::isOpwiseShiftValid(AffineForOp forOp, ArrayRef<uint64_t> shifts) {
}
return true;
}
-
-/// Returns true if `value` (transitively) depends on iteration-carried values
-/// of the given `ancestorOp`.
-static bool dependsOnCarriedVals(Value value,
- ArrayRef<BlockArgument> iterCarriedArgs,
- Operation *ancestorOp) {
- // Compute the backward slice of the value.
- SetVector<Operation *> slice;
- getBackwardSlice(value, &slice,
- [&](Operation *op) { return !ancestorOp->isAncestor(op); });
-
- // Check that none of the operands of the operations in the backward slice are
- // loop iteration arguments, and neither is the value itself.
- SmallPtrSet<Value, 8> iterCarriedValSet(iterCarriedArgs.begin(),
- iterCarriedArgs.end());
- if (iterCarriedValSet.contains(value))
- return true;
-
- for (Operation *op : slice)
- for (Value operand : op->getOperands())
- if (iterCarriedValSet.contains(operand))
- return true;
-
- return false;
-}
-
-/// Utility to match a generic reduction given a list of iteration-carried
-/// arguments, `iterCarriedArgs` and the position of the potential reduction
-/// argument within the list, `redPos`. If a reduction is matched, returns the
-/// reduced value and the topologically-sorted list of combiner operations
-/// involved in the reduction. Otherwise, returns a null value.
-///
-/// The matching algorithm relies on the following invariants, which are subject
-/// to change:
-/// 1. The first combiner operation must be a binary operation with the
-/// iteration-carried value and the reduced value as operands.
-/// 2. The iteration-carried value and combiner operations must be side
-/// effect-free, have single result and a single use.
-/// 3. Combiner operations must be immediately nested in the region op
-/// performing the reduction.
-/// 4. Reduction def-use chain must end in a terminator op that yields the
-/// next iteration/output values in the same order as the iteration-carried
-/// values in `iterCarriedArgs`.
-/// 5. `iterCarriedArgs` must contain all the iteration-carried/output values
-/// of the region op performing the reduction.
-///
-/// This utility is generic enough to detect reductions involving multiple
-/// combiner operations (disabled for now) across multiple dialects, including
-/// Linalg, Affine and SCF. For the sake of genericity, it does not return
-/// specific enum values for the combiner operations since its goal is also
-/// matching reductions without pre-defined semantics in core MLIR. It's up to
-/// each client to make sense out of the list of combiner operations. It's also
-/// up to each client to check for additional invariants on the expected
-/// reductions not covered by this generic matching.
-Value mlir::matchReduction(ArrayRef<BlockArgument> iterCarriedArgs,
- unsigned redPos,
- SmallVectorImpl<Operation *> &combinerOps) {
- assert(redPos < iterCarriedArgs.size() && "'redPos' is out of bounds");
-
- BlockArgument redCarriedVal = iterCarriedArgs[redPos];
- if (!redCarriedVal.hasOneUse())
- return nullptr;
-
- // For now, the first combiner op must be a binary op.
- Operation *combinerOp = *redCarriedVal.getUsers().begin();
- if (combinerOp->getNumOperands() != 2)
- return nullptr;
- Value reducedVal = combinerOp->getOperand(0) == redCarriedVal
- ? combinerOp->getOperand(1)
- : combinerOp->getOperand(0);
-
- Operation *redRegionOp =
- iterCarriedArgs.front().getOwner()->getParent()->getParentOp();
- if (dependsOnCarriedVals(reducedVal, iterCarriedArgs, redRegionOp))
- return nullptr;
-
- // Traverse the def-use chain starting from the first combiner op until a
- // terminator is found. Gather all the combiner ops along the way in
- // topological order.
- while (!combinerOp->mightHaveTrait<OpTrait::IsTerminator>()) {
- if (!MemoryEffectOpInterface::hasNoEffect(combinerOp) ||
- combinerOp->getNumResults() != 1 || !combinerOp->hasOneUse() ||
- combinerOp->getParentOp() != redRegionOp)
- return nullptr;
-
- combinerOps.push_back(combinerOp);
- combinerOp = *combinerOp->getUsers().begin();
- }
-
- // Limit matching to single combiner op until we can properly test reductions
- // involving multiple combiners.
- if (combinerOps.size() != 1)
- return nullptr;
-
- // Check that the yielded value is in the same position as in
- // `iterCarriedArgs`.
- Operation *terminatorOp = combinerOp;
- if (terminatorOp->getOperand(redPos) != combinerOps.back()->getResults()[0])
- return nullptr;
-
- return reducedVal;
-}
diff --git a/mlir/lib/Analysis/NestedMatcher.cpp b/mlir/lib/Dialect/Affine/Analysis/NestedMatcher.cpp
similarity index 99%
rename from mlir/lib/Analysis/NestedMatcher.cpp
rename to mlir/lib/Dialect/Affine/Analysis/NestedMatcher.cpp
index 8e6b2457b2385..c38cdb7582d30 100644
--- a/mlir/lib/Analysis/NestedMatcher.cpp
+++ b/mlir/lib/Dialect/Affine/Analysis/NestedMatcher.cpp
@@ -8,7 +8,7 @@
#include <utility>
-#include "mlir/Analysis/NestedMatcher.h"
+#include "mlir/Dialect/Affine/Analysis/NestedMatcher.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
diff --git a/mlir/lib/Analysis/Utils.cpp b/mlir/lib/Dialect/Affine/Analysis/Utils.cpp
similarity index 99%
rename from mlir/lib/Analysis/Utils.cpp
rename to mlir/lib/Dialect/Affine/Analysis/Utils.cpp
index beb79b017d63d..d6ceb0ef6477b 100644
--- a/mlir/lib/Analysis/Utils.cpp
+++ b/mlir/lib/Dialect/Affine/Analysis/Utils.cpp
@@ -11,10 +11,10 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Analysis/Utils.h"
-#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/LoopAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Analysis/Presburger/PresburgerSet.h"
+#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
diff --git a/mlir/lib/Dialect/Affine/CMakeLists.txt b/mlir/lib/Dialect/Affine/CMakeLists.txt
index 31167e6af908b..35c4201f21454 100644
--- a/mlir/lib/Dialect/Affine/CMakeLists.txt
+++ b/mlir/lib/Dialect/Affine/CMakeLists.txt
@@ -1,3 +1,4 @@
+add_subdirectory(Analysis)
add_subdirectory(IR)
add_subdirectory(Transforms)
add_subdirectory(Utils)
diff --git a/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp
index af11ae5ad7f0e..a20b70f9734cc 100644
--- a/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp
@@ -20,7 +20,7 @@
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
diff --git a/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
index b6f9e4c706313..caad8d648718d 100644
--- a/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
@@ -11,11 +11,11 @@
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
-#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/AffineStructures.h"
-#include "mlir/Analysis/LoopAnalysis.h"
#include "mlir/Analysis/SliceAnalysis.h"
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
+#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
diff --git a/mlir/lib/Dialect/Affine/Transforms/AffineParallelize.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineParallelize.cpp
index add9a802ad785..86712a3a2540a 100644
--- a/mlir/lib/Dialect/Affine/Transforms/AffineParallelize.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/AffineParallelize.cpp
@@ -12,10 +12,10 @@
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
-#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/AffineStructures.h"
-#include "mlir/Analysis/LoopAnalysis.h"
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
+#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/Affine/Passes.h"
diff --git a/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
index 52b9fc6fcd03c..d1823c918e392 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
@@ -11,10 +11,10 @@
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
-#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/AffineStructures.h"
-#include "mlir/Analysis/LoopAnalysis.h"
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
+#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/Affine/Passes.h"
diff --git a/mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp
index 5063d8c66977a..b232c1134644b 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp
@@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
-#include "mlir/Analysis/LoopAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/IR/AffineExpr.h"
diff --git a/mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp
index cf8e15104f8b4..948e2ba2f03a0 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp
@@ -34,8 +34,8 @@
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
-#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/LoopAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/IR/AffineExpr.h"
diff --git a/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp b/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp
index 04417b92b8e19..51794e3698d7b 100644
--- a/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp
@@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/IR/IntegerSet.h"
diff --git a/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp b/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
index 974d7d1106c20..5dba727a70d09 100644
--- a/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
@@ -12,9 +12,9 @@
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
-#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/LoopAnalysis.h"
-#include "mlir/Analysis/NestedMatcher.h"
+#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/NestedMatcher.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Utils.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
diff --git a/mlir/lib/Dialect/Affine/Utils/Utils.cpp b/mlir/lib/Dialect/Affine/Utils/Utils.cpp
index 1037040333cb5..941ff3c88778c 100644
--- a/mlir/lib/Dialect/Affine/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/Affine/Utils/Utils.cpp
@@ -13,7 +13,7 @@
#include "mlir/Dialect/Affine/Utils.h"
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
diff --git a/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt b/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
index bc7a107831716..6e62e4a1aadb4 100644
--- a/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
@@ -5,10 +5,10 @@ add_mlir_dialect_library(MLIRLinalgAnalysis
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Linalg
LINK_LIBS PUBLIC
+ MLIRAffineAnalysis
MLIRAnalysis
MLIRIR
MLIRLinalg
- MLIRLoopAnalysis
MLIRMemRef
MLIRStandard
)
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
index d8875663487d1..097500f7190c4 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
@@ -12,8 +12,8 @@
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/Linalg/Transforms/Hoisting.h"
-#include "mlir/Analysis/AffineStructures.h"
#include "mlir/Analysis/SliceAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/Affine/Utils.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
index db3e7197a0aac..7472d9ee20898 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
@@ -10,8 +10,8 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Analysis/LoopAnalysis.h"
#include "mlir/Analysis/SliceAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
diff --git a/mlir/lib/Dialect/Linalg/Utils/Utils.cpp b/mlir/lib/Dialect/Linalg/Utils/Utils.cpp
index a197c141403b6..61be7bc6c6461 100644
--- a/mlir/lib/Dialect/Linalg/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/Linalg/Utils/Utils.cpp
@@ -12,8 +12,8 @@
#include "mlir/Dialect/Linalg/Utils/Utils.h"
-#include "mlir/Analysis/AffineStructures.h"
#include "mlir/Analysis/SliceAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
diff --git a/mlir/lib/Dialect/SCF/Transforms/AffineCanonicalizationUtils.cpp b/mlir/lib/Dialect/SCF/Transforms/AffineCanonicalizationUtils.cpp
index 59dc76635f130..513c8afd61063 100644
--- a/mlir/lib/Dialect/SCF/Transforms/AffineCanonicalizationUtils.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/AffineCanonicalizationUtils.cpp
@@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/SCF/AffineCanonicalizationUtils.h"
-#include "mlir/Analysis/AffineStructures.h"
+#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/Utils/StaticValueUtils.h"
diff --git a/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp b/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
index da15c49c9107b..acdc95c059e95 100644
--- a/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
@@ -12,7 +12,7 @@
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
-#include "mlir/Analysis/AffineStructures.h"
+#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/SCF/AffineCanonicalizationUtils.h"
diff --git a/mlir/lib/Dialect/Vector/CMakeLists.txt b/mlir/lib/Dialect/Vector/CMakeLists.txt
index 36afc18ff0bea..3568d6e5ea06e 100644
--- a/mlir/lib/Dialect/Vector/CMakeLists.txt
+++ b/mlir/lib/Dialect/Vector/CMakeLists.txt
@@ -27,7 +27,7 @@ add_mlir_dialect_library(MLIRVector
MLIRLinalg
MLIRMemRef
MLIRSCF
- MLIRLoopAnalysis
+ MLIRAffineAnalysis
MLIRDataLayoutInterfaces
MLIRSideEffectInterfaces
MLIRVectorInterfaces
diff --git a/mlir/lib/Dialect/Vector/VectorUtils.cpp b/mlir/lib/Dialect/Vector/VectorUtils.cpp
index a6a0a25dcd89d..23a695d1b81d7 100644
--- a/mlir/lib/Dialect/Vector/VectorUtils.cpp
+++ b/mlir/lib/Dialect/Vector/VectorUtils.cpp
@@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/Vector/VectorUtils.h"
-#include "mlir/Analysis/LoopAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
diff --git a/mlir/lib/Transforms/LoopFusion.cpp b/mlir/lib/Transforms/LoopFusion.cpp
index 56bc8e3dca6c8..9646eeb5f9b80 100644
--- a/mlir/lib/Transforms/LoopFusion.cpp
+++ b/mlir/lib/Transforms/LoopFusion.cpp
@@ -11,10 +11,10 @@
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
-#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/AffineStructures.h"
-#include "mlir/Analysis/LoopAnalysis.h"
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
+#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/AffineExpr.h"
diff --git a/mlir/lib/Transforms/PipelineDataTransfer.cpp b/mlir/lib/Transforms/PipelineDataTransfer.cpp
index fd9bba81c4a2b..1b1a9ccdc864b 100644
--- a/mlir/lib/Transforms/PipelineDataTransfer.cpp
+++ b/mlir/lib/Transforms/PipelineDataTransfer.cpp
@@ -13,9 +13,9 @@
#include "PassDetail.h"
#include "mlir/Transforms/Passes.h"
-#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/LoopAnalysis.h"
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/StandardOps/Utils/Utils.h"
diff --git a/mlir/lib/Transforms/Utils/CMakeLists.txt b/mlir/lib/Transforms/Utils/CMakeLists.txt
index b564c06ec4bd7..33deb17fe1378 100644
--- a/mlir/lib/Transforms/Utils/CMakeLists.txt
+++ b/mlir/lib/Transforms/Utils/CMakeLists.txt
@@ -18,7 +18,7 @@ add_mlir_library(MLIRTransformUtils
MLIRAffine
MLIRArithmetic
MLIRAnalysis
- MLIRLoopAnalysis
+ MLIRAffineAnalysis
MLIRMemRef
MLIRSCF
MLIRPass
diff --git a/mlir/lib/Transforms/Utils/LoopFusionUtils.cpp b/mlir/lib/Transforms/Utils/LoopFusionUtils.cpp
index a4043b20ec505..54adec2c09b1a 100644
--- a/mlir/lib/Transforms/Utils/LoopFusionUtils.cpp
+++ b/mlir/lib/Transforms/Utils/LoopFusionUtils.cpp
@@ -12,11 +12,11 @@
#include "mlir/Transforms/LoopFusionUtils.h"
-#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/AffineStructures.h"
-#include "mlir/Analysis/LoopAnalysis.h"
#include "mlir/Analysis/SliceAnalysis.h"
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
+#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
diff --git a/mlir/lib/Transforms/Utils/LoopUtils.cpp b/mlir/lib/Transforms/Utils/LoopUtils.cpp
index 9d94a5d8de905..b9352ac2c2b75 100644
--- a/mlir/lib/Transforms/Utils/LoopUtils.cpp
+++ b/mlir/lib/Transforms/Utils/LoopUtils.cpp
@@ -12,10 +12,10 @@
#include "mlir/Transforms/LoopUtils.h"
-#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/LoopAnalysis.h"
#include "mlir/Analysis/SliceAnalysis.h"
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
diff --git a/mlir/lib/Transforms/Utils/Utils.cpp b/mlir/lib/Transforms/Utils/Utils.cpp
index 86ade8db70cca..b2936bbca9620 100644
--- a/mlir/lib/Transforms/Utils/Utils.cpp
+++ b/mlir/lib/Transforms/Utils/Utils.cpp
@@ -12,9 +12,9 @@
//===----------------------------------------------------------------------===//
#include "mlir/Transforms/Utils.h"
-#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/AffineStructures.h"
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
diff --git a/mlir/test/lib/Analysis/TestMatchReduction.cpp b/mlir/test/lib/Analysis/TestMatchReduction.cpp
index dde27f3c7bd16..ee5170516b840 100644
--- a/mlir/test/lib/Analysis/TestMatchReduction.cpp
+++ b/mlir/test/lib/Analysis/TestMatchReduction.cpp
@@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Analysis/LoopAnalysis.h"
+#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Pass/Pass.h"
using namespace mlir;
diff --git a/mlir/test/lib/Analysis/TestMemRefBoundCheck.cpp b/mlir/test/lib/Analysis/TestMemRefBoundCheck.cpp
index e49f986fca641..6931d8c0f8338 100644
--- a/mlir/test/lib/Analysis/TestMemRefBoundCheck.cpp
+++ b/mlir/test/lib/Analysis/TestMemRefBoundCheck.cpp
@@ -11,9 +11,9 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/AffineStructures.h"
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/IR/Builders.h"
#include "mlir/Pass/Pass.h"
diff --git a/mlir/test/lib/Analysis/TestMemRefDependenceCheck.cpp b/mlir/test/lib/Analysis/TestMemRefDependenceCheck.cpp
index 01fba3acfa7d9..bbe18b0b186ed 100644
--- a/mlir/test/lib/Analysis/TestMemRefDependenceCheck.cpp
+++ b/mlir/test/lib/Analysis/TestMemRefDependenceCheck.cpp
@@ -10,9 +10,9 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/AffineStructures.h"
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/IR/Builders.h"
#include "mlir/Pass/Pass.h"
diff --git a/mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp b/mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp
index 07b6a8fe8df8c..d618da4421901 100644
--- a/mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp
+++ b/mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp
@@ -11,7 +11,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Pass/Pass.h"
diff --git a/mlir/test/lib/Dialect/Affine/TestAffineLoopUnswitching.cpp b/mlir/test/lib/Dialect/Affine/TestAffineLoopUnswitching.cpp
index ca65d9550a46f..837c64aa0ea0f 100644
--- a/mlir/test/lib/Dialect/Affine/TestAffineLoopUnswitching.cpp
+++ b/mlir/test/lib/Dialect/Affine/TestAffineLoopUnswitching.cpp
@@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Utils.h"
#include "mlir/Pass/Pass.h"
diff --git a/mlir/test/lib/Dialect/Affine/TestLoopPermutation.cpp b/mlir/test/lib/Dialect/Affine/TestLoopPermutation.cpp
index 1a997dc60e9af..6db6c80e4c1cb 100644
--- a/mlir/test/lib/Dialect/Affine/TestLoopPermutation.cpp
+++ b/mlir/test/lib/Dialect/Affine/TestLoopPermutation.cpp
@@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/LoopUtils.h"
diff --git a/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp b/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp
index d9dfe7b1330af..06c9366248a09 100644
--- a/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp
+++ b/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp
@@ -10,9 +10,9 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/NestedMatcher.h"
#include "mlir/Analysis/SliceAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
+#include "mlir/Dialect/Affine/Analysis/NestedMatcher.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Utils.h"
#include "mlir/Dialect/Vector/VectorOps.h"
diff --git a/mlir/test/lib/Transforms/TestLoopFusion.cpp b/mlir/test/lib/Transforms/TestLoopFusion.cpp
index 7dc40e0d503e9..7c1e3a2674625 100644
--- a/mlir/test/lib/Transforms/TestLoopFusion.cpp
+++ b/mlir/test/lib/Transforms/TestLoopFusion.cpp
@@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Analysis/Utils.h"
+#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Pass/Pass.h"
diff --git a/mlir/tools/mlir-lsp-server/CMakeLists.txt b/mlir/tools/mlir-lsp-server/CMakeLists.txt
index 9063fcd8d10e5..204c7aeac2924 100644
--- a/mlir/tools/mlir-lsp-server/CMakeLists.txt
+++ b/mlir/tools/mlir-lsp-server/CMakeLists.txt
@@ -29,7 +29,7 @@ set(LIBS
${dialect_libs}
${conversion_libs}
${test_libs}
- MLIRLoopAnalysis
+ MLIRAffineAnalysis
MLIRAnalysis
MLIRDialect
MLIRLspServerLib
diff --git a/mlir/tools/mlir-opt/CMakeLists.txt b/mlir/tools/mlir-opt/CMakeLists.txt
index 6c9c5831c0816..7a16a497b6f86 100644
--- a/mlir/tools/mlir-opt/CMakeLists.txt
+++ b/mlir/tools/mlir-opt/CMakeLists.txt
@@ -37,7 +37,7 @@ set(LIBS
${dialect_libs}
${conversion_libs}
${test_libs}
- MLIRLoopAnalysis
+ MLIRAffineAnalysis
MLIRAnalysis
MLIRDialect
MLIROptLib
diff --git a/mlir/unittests/Analysis/CMakeLists.txt b/mlir/unittests/Analysis/CMakeLists.txt
index b85dbab013438..a05d09f89070c 100644
--- a/mlir/unittests/Analysis/CMakeLists.txt
+++ b/mlir/unittests/Analysis/CMakeLists.txt
@@ -1,12 +1 @@
-add_mlir_unittest(MLIRAnalysisTests
- AffineStructuresParser.cpp
- AffineStructuresParserTest.cpp
-)
-
-target_link_libraries(MLIRAnalysisTests
- PRIVATE
- MLIRLoopAnalysis
- MLIRParser
- )
-
add_subdirectory(Presburger)
diff --git a/mlir/unittests/Analysis/Presburger/CMakeLists.txt b/mlir/unittests/Analysis/Presburger/CMakeLists.txt
index e0dd5a07e6992..2bdb2e7bd11c4 100644
--- a/mlir/unittests/Analysis/Presburger/CMakeLists.txt
+++ b/mlir/unittests/Analysis/Presburger/CMakeLists.txt
@@ -4,11 +4,11 @@ add_mlir_unittest(MLIRPresburgerTests
MatrixTest.cpp
PresburgerSetTest.cpp
SimplexTest.cpp
- ../AffineStructuresParser.cpp
+ ../../Dialect/Affine/Analysis/AffineStructuresParser.cpp
)
target_link_libraries(MLIRPresburgerTests
PRIVATE MLIRPresburger
- MLIRLoopAnalysis
+ MLIRAffineAnalysis
MLIRParser
)
diff --git a/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp b/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
index 15a9e1461ab20..2e4c135770431 100644
--- a/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
+++ b/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Analysis/Presburger/IntegerPolyhedron.h"
-#include "../AffineStructuresParser.h"
+#include "../../Dialect/Affine/Analysis/AffineStructuresParser.h"
#include "mlir/IR/MLIRContext.h"
#include <gmock/gmock.h>
diff --git a/mlir/unittests/Analysis/Presburger/PresburgerSetTest.cpp b/mlir/unittests/Analysis/Presburger/PresburgerSetTest.cpp
index 39ea7fb7e28f5..2a75a5c84cbe0 100644
--- a/mlir/unittests/Analysis/Presburger/PresburgerSetTest.cpp
+++ b/mlir/unittests/Analysis/Presburger/PresburgerSetTest.cpp
@@ -15,7 +15,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Analysis/Presburger/PresburgerSet.h"
-#include "../AffineStructuresParser.h"
+#include "../../Dialect/Affine/Analysis/AffineStructuresParser.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
diff --git a/mlir/unittests/Analysis/Presburger/SimplexTest.cpp b/mlir/unittests/Analysis/Presburger/SimplexTest.cpp
index 40fa9e3d60bea..0791ebeba564c 100644
--- a/mlir/unittests/Analysis/Presburger/SimplexTest.cpp
+++ b/mlir/unittests/Analysis/Presburger/SimplexTest.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Analysis/Presburger/Simplex.h"
-#include "../AffineStructuresParser.h"
+#include "../../Dialect/Affine/Analysis/AffineStructuresParser.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
diff --git a/mlir/unittests/Analysis/AffineStructuresParser.cpp b/mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParser.cpp
similarity index 100%
rename from mlir/unittests/Analysis/AffineStructuresParser.cpp
rename to mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParser.cpp
diff --git a/mlir/unittests/Analysis/AffineStructuresParser.h b/mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParser.h
similarity index 95%
rename from mlir/unittests/Analysis/AffineStructuresParser.h
rename to mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParser.h
index ad0bb9d6ea8ba..dcb63aef74c27 100644
--- a/mlir/unittests/Analysis/AffineStructuresParser.h
+++ b/mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParser.h
@@ -14,7 +14,7 @@
#ifndef MLIR_UNITTEST_ANALYSIS_AFFINESTRUCTURESPARSER_H
#define MLIR_UNITTEST_ANALYSIS_AFFINESTRUCTURESPARSER_H
-#include "mlir/Analysis/AffineStructures.h"
+#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
#include "mlir/Support/LogicalResult.h"
namespace mlir {
diff --git a/mlir/unittests/Analysis/AffineStructuresParserTest.cpp b/mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParserTest.cpp
similarity index 100%
rename from mlir/unittests/Analysis/AffineStructuresParserTest.cpp
rename to mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParserTest.cpp
diff --git a/mlir/unittests/Dialect/Affine/Analysis/CMakeLists.txt b/mlir/unittests/Dialect/Affine/Analysis/CMakeLists.txt
new file mode 100644
index 0000000000000..b5f81b4a50287
--- /dev/null
+++ b/mlir/unittests/Dialect/Affine/Analysis/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_mlir_unittest(MLIRAffineAnalysisTests
+ AffineStructuresParser.cpp
+ AffineStructuresParserTest.cpp
+)
+
+target_link_libraries(MLIRAffineAnalysisTests
+ PRIVATE
+ MLIRAffineAnalysis
+ MLIRParser
+ )
diff --git a/mlir/unittests/Dialect/Affine/CMakeLists.txt b/mlir/unittests/Dialect/Affine/CMakeLists.txt
new file mode 100644
index 0000000000000..fc6ef10fab1f5
--- /dev/null
+++ b/mlir/unittests/Dialect/Affine/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(Analysis)
diff --git a/mlir/unittests/Dialect/CMakeLists.txt b/mlir/unittests/Dialect/CMakeLists.txt
index f37f578572b8f..8a0f418d3bf57 100644
--- a/mlir/unittests/Dialect/CMakeLists.txt
+++ b/mlir/unittests/Dialect/CMakeLists.txt
@@ -6,6 +6,7 @@ target_link_libraries(MLIRDialectTests
MLIRIR
MLIRDialect)
+add_subdirectory(Affine)
add_subdirectory(Quant)
add_subdirectory(SparseTensor)
add_subdirectory(SPIRV)
More information about the Mlir-commits
mailing list