From 984e270a9a7063c370bcc80ee1fb3ec874d92b93 Mon Sep 17 00:00:00 2001 From: Stephen Neuendorffer Date: Fri, 11 Jun 2021 16:58:07 -0700 Subject: [PATCH] [mlir] make normalizeAffineFor public Previously this was just a static method. --- mlir/include/mlir/Dialect/Affine/Utils.h | 8 ++++++++ mlir/lib/Dialect/Affine/Transforms/AffineLoopNormalize.cpp | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mlir/include/mlir/Dialect/Affine/Utils.h b/mlir/include/mlir/Dialect/Affine/Utils.h index 693af77..ee849c9 100644 --- a/mlir/include/mlir/Dialect/Affine/Utils.h +++ b/mlir/include/mlir/Dialect/Affine/Utils.h @@ -146,6 +146,14 @@ vectorizeAffineLoopNest(std::vector> &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 1a785a0..8ca6580 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; -- 2.7.4