[Mlir-commits] [mlir] cdc5cba - [MLIR][Affine][NFC] Expose expandAffineMap
Frank Laub
llvmlistbot at llvm.org
Wed Mar 4 14:17:28 PST 2020
Author: Frank Laub
Date: 2020-03-04T14:17:17-08:00
New Revision: cdc5cba7211a8be044b485222e3a3722d9802d21
URL: https://github.com/llvm/llvm-project/commit/cdc5cba7211a8be044b485222e3a3722d9802d21
DIFF: https://github.com/llvm/llvm-project/commit/cdc5cba7211a8be044b485222e3a3722d9802d21.diff
LOG: [MLIR][Affine][NFC] Expose expandAffineMap
Summary:
Expose expandAffineMap so that it can be used by lowerings defined outside of
MLIR core.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D75589
Added:
Modified:
mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h
mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h b/mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h
index 8843e8187b8e..967c74c5c23f 100644
--- a/mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h
+++ b/mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h
@@ -14,6 +14,7 @@
namespace mlir {
class AffineExpr;
class AffineForOp;
+class AffineMap;
class Location;
struct LogicalResult;
class MLIRContext;
@@ -30,6 +31,13 @@ class OwningRewritePatternList;
Value expandAffineExpr(OpBuilder &builder, Location loc, AffineExpr expr,
ValueRange dimValues, ValueRange symbolValues);
+/// Create a sequence of operations that implement the `affineMap` applied to
+/// the given `operands` (as it it were an AffineApplyOp).
+Optional<SmallVector<Value, 8>> expandAffineMap(OpBuilder &builder,
+ Location loc,
+ AffineMap affineMap,
+ ValueRange operands);
+
/// Collect a set of patterns to convert from the Affine dialect to the Standard
/// dialect, in particular convert structured affine control flow into CFG
/// branch-based control flow.
diff --git a/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp b/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
index 17b916b77964..6c84268df8d7 100644
--- a/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
+++ b/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
@@ -216,10 +216,10 @@ mlir::Value mlir::expandAffineExpr(OpBuilder &builder, Location loc,
/// Create a sequence of operations that implement the `affineMap` applied to
/// the given `operands` (as it it were an AffineApplyOp).
-Optional<SmallVector<Value, 8>> static expandAffineMap(OpBuilder &builder,
- Location loc,
- AffineMap affineMap,
- ValueRange operands) {
+Optional<SmallVector<Value, 8>> mlir::expandAffineMap(OpBuilder &builder,
+ Location loc,
+ AffineMap affineMap,
+ ValueRange operands) {
auto numDims = affineMap.getNumDims();
auto expanded = functional::map(
[numDims, &builder, loc, operands](AffineExpr expr) {
More information about the Mlir-commits
mailing list