[Mlir-commits] [mlir] 984e270 - [mlir] make normalizeAffineFor public

Stephen Neuendorffer llvmlistbot at llvm.org
Fri Jun 11 20:25:04 PDT 2021


Author: Stephen Neuendorffer
Date: 2021-06-11T20:12:37-07:00
New Revision: 984e270a9a7063c370bcc80ee1fb3ec874d92b93

URL: https://github.com/llvm/llvm-project/commit/984e270a9a7063c370bcc80ee1fb3ec874d92b93
DIFF: https://github.com/llvm/llvm-project/commit/984e270a9a7063c370bcc80ee1fb3ec874d92b93.diff

LOG: [mlir] make normalizeAffineFor public

Previously this was just a static method.

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Affine/Utils.h
    mlir/lib/Dialect/Affine/Transforms/AffineLoopNormalize.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Affine/Utils.h b/mlir/include/mlir/Dialect/Affine/Utils.h
index 693af77c6e86b..ee849c961815b 100644
--- a/mlir/include/mlir/Dialect/Affine/Utils.h
+++ b/mlir/include/mlir/Dialect/Affine/Utils.h
@@ -146,6 +146,14 @@ vectorizeAffineLoopNest(std::vector<SmallVector<AffineForOp, 2>> &loops,
 /// early if the op is already in a normalized form.
 void normalizeAffineParallel(AffineParallelOp op);
 
+/// Normalize an affine.for op. If the affine.for op has only a single iteration
+/// only then it is simply promoted, else it is normalized in the traditional
+/// way, by converting the lower bound to zero and loop step to one. The upper
+/// bound is set to the trip count of the loop. For now, original loops must
+/// have lower bound with a single result only. There is no such restriction on
+/// upper bounds.
+void normalizeAffineFor(AffineForOp op);
+
 /// Traverse `e` and return an AffineExpr where all occurrences of `dim` have
 /// been replaced by either:
 ///  - `min` if `positivePath` is true when we reach an occurrence of `dim`

diff  --git a/mlir/lib/Dialect/Affine/Transforms/AffineLoopNormalize.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineLoopNormalize.cpp
index 1a785a03df763..8ca65805aef6f 100644
--- a/mlir/lib/Dialect/Affine/Transforms/AffineLoopNormalize.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/AffineLoopNormalize.cpp
@@ -91,7 +91,7 @@ void mlir::normalizeAffineParallel(AffineParallelOp op) {
 /// bound is set to the trip count of the loop. For now, original loops must
 /// have lower bound with a single result only. There is no such restriction on
 /// upper bounds.
-static void normalizeAffineFor(AffineForOp op) {
+void mlir::normalizeAffineFor(AffineForOp op) {
   if (succeeded(promoteIfSingleIteration(op)))
     return;
 


        


More information about the Mlir-commits mailing list