[Mlir-commits] [mlir] e75325c - [mlir][Affine] Minor clean-up of D79829

Diego Caballero llvmlistbot at llvm.org
Fri May 29 14:48:50 PDT 2020


Author: Diego Caballero
Date: 2020-05-29T14:39:18-07:00
New Revision: e75325cfc397c562964dd39b47198d73c9e9602a

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

LOG: [mlir][Affine] Minor clean-up of D79829

Addressing D79829 post-commit comments. Minor changes.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D80814

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h
    mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.td
    mlir/include/mlir/Dialect/Affine/IR/CMakeLists.txt
    mlir/lib/Analysis/AffineAnalysis.cpp
    mlir/lib/Dialect/Affine/IR/AffineMemoryOpInterfaces.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h b/mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h
index f42fc256befa..1f4fdb6126fe 100644
--- a/mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h
+++ b/mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h
@@ -10,8 +10,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef MLIR_INTERFACES_AFFINEMEMORYOPINTERFACES_H_
-#define MLIR_INTERFACES_AFFINEMEMORYOPINTERFACES_H_
+#ifndef MLIR_DIALECT_AFFINE_IR_AFFINEMEMORYOPDIALECT_H_
+#define MLIR_DIALECT_AFFINE_IR_AFFINEMEMORYOPDIALECT_H_
 
 #include "mlir/IR/AffineMap.h"
 #include "mlir/IR/OpDefinition.h"
@@ -21,4 +21,4 @@ namespace mlir {
 #include "mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h.inc"
 } // namespace mlir
 
-#endif // MLIR_INTERFACES_AFFINEMEMORYOPINTERFACES_H_
+#endif // MLIR_DIALECT_AFFINE_IR_AFFINEMEMORYOPDIALECT_H_

diff  --git a/mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.td b/mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.td
index 8738000d8d5f..dd174da44731 100644
--- a/mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.td
+++ b/mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.td
@@ -10,8 +10,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef MLIR_AFFINEMEMORYOPINTERFACES
-#define MLIR_AFFINEMEMORYOPINTERFACES
+#ifndef AFFINEMEMORYOPINTERFACES
+#define AFFINEMEMORYOPINTERFACES
 
 include "mlir/IR/OpBase.td"
 
@@ -23,7 +23,7 @@ def AffineReadOpInterface : OpInterface<"AffineReadOpInterface"> {
 
   let methods = [
     InterfaceMethod<
-      /*desc=*/[{ Returns the memref operand to read from. }],
+      /*desc=*/"Returns the memref operand to read from.",
       /*retTy=*/"Value",
       /*methodName=*/"getMemRef",
       /*args=*/(ins),
@@ -34,7 +34,7 @@ def AffineReadOpInterface : OpInterface<"AffineReadOpInterface"> {
       }]
     >,
     InterfaceMethod<
-      /*desc=*/[{ Returns the type of the memref operand. }],
+      /*desc=*/"Returns the type of the memref operand.",
       /*retTy=*/"MemRefType",
       /*methodName=*/"getMemRefType",
       /*args=*/(ins),
@@ -45,7 +45,7 @@ def AffineReadOpInterface : OpInterface<"AffineReadOpInterface"> {
       }]
     >,
     InterfaceMethod<
-      /*desc=*/[{ Returns affine map operands. }],
+      /*desc=*/"Returns affine map operands.",
       /*retTy=*/"Operation::operand_range",
       /*methodName=*/"getMapOperands",
       /*args=*/(ins),
@@ -56,8 +56,9 @@ def AffineReadOpInterface : OpInterface<"AffineReadOpInterface"> {
       }]
     >,
     InterfaceMethod<
-      /*desc=*/[{ Returns the affine map used to index the memref for this
-                  operation. }],
+      /*desc=*/[{
+        Returns the affine map used to index the memref for this operation.
+      }],
       /*retTy=*/"AffineMap",
       /*methodName=*/"getAffineMap",
       /*args=*/(ins),
@@ -78,7 +79,7 @@ def AffineWriteOpInterface : OpInterface<"AffineWriteOpInterface"> {
 
   let methods = [
     InterfaceMethod<
-      /*desc=*/[{ Returns the memref operand to write to. }],
+      /*desc=*/"Returns the memref operand to write to.",
       /*retTy=*/"Value",
       /*methodName=*/"getMemRef",
       /*args=*/(ins),
@@ -89,7 +90,7 @@ def AffineWriteOpInterface : OpInterface<"AffineWriteOpInterface"> {
       }]
     >,
     InterfaceMethod<
-      /*desc=*/[{ Returns the type of the memref operand. }],
+      /*desc=*/"Returns the type of the memref operand.",
       /*retTy=*/"MemRefType",
       /*methodName=*/"getMemRefType",
       /*args=*/(ins),
@@ -100,7 +101,7 @@ def AffineWriteOpInterface : OpInterface<"AffineWriteOpInterface"> {
       }]
     >,
     InterfaceMethod<
-      /*desc=*/[{ Returns affine map operands. }],
+      /*desc=*/"Returns affine map operands.",
       /*retTy=*/"Operation::operand_range",
       /*methodName=*/"getMapOperands",
       /*args=*/(ins),
@@ -111,8 +112,9 @@ def AffineWriteOpInterface : OpInterface<"AffineWriteOpInterface"> {
       }]
     >,
     InterfaceMethod<
-      /*desc=*/[{ Returns the affine map used to index the memref for this
-                  operation. }],
+      /*desc=*/[{
+        Returns the affine map used to index the memref for this operation.
+      }],
       /*retTy=*/"AffineMap",
       /*methodName=*/"getAffineMap",
       /*args=*/(ins),
@@ -125,4 +127,4 @@ def AffineWriteOpInterface : OpInterface<"AffineWriteOpInterface"> {
   ];
 }
 
-#endif // MLIR_AFFINEMEMORYOPINTERFACES
+#endif // AFFINEMEMORYOPINTERFACES

diff  --git a/mlir/include/mlir/Dialect/Affine/IR/CMakeLists.txt b/mlir/include/mlir/Dialect/Affine/IR/CMakeLists.txt
index 77806274f14c..f0bb4caeec38 100644
--- a/mlir/include/mlir/Dialect/Affine/IR/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/Affine/IR/CMakeLists.txt
@@ -1,10 +1,5 @@
 add_mlir_dialect(AffineOps affine)
 add_mlir_doc(AffineOps -gen-op-doc AffineOps Dialects/)
 
-set(LLVM_TARGET_DEFINITIONS AffineMemoryOpInterfaces.td)
-mlir_tablegen(AffineMemoryOpInterfaces.h.inc -gen-op-interface-decls)
-mlir_tablegen(AffineMemoryOpInterfaces.cpp.inc -gen-op-interface-defs)
-add_public_tablegen_target(MLIRAffineMemoryOpInterfacesIncGen)
-add_dependencies(mlir-generic-headers MLIRAffineMemoryOpInterfacesIncGen)
-
+add_mlir_interface(AffineMemoryOpInterfaces)
 add_dependencies(MLIRAffineOpsIncGen MLIRAffineMemoryOpInterfacesIncGen)

diff  --git a/mlir/lib/Analysis/AffineAnalysis.cpp b/mlir/lib/Analysis/AffineAnalysis.cpp
index 8c4828805882..ca662c71fe43 100644
--- a/mlir/lib/Analysis/AffineAnalysis.cpp
+++ b/mlir/lib/Analysis/AffineAnalysis.cpp
@@ -660,12 +660,11 @@ static void computeDirectionVector(
 void MemRefAccess::getAccessMap(AffineValueMap *accessMap) const {
   // Get affine map from AffineLoad/Store.
   AffineMap map;
-  if (auto loadOp = dyn_cast<AffineReadOpInterface>(opInst)) {
+  if (auto loadOp = dyn_cast<AffineReadOpInterface>(opInst))
     map = loadOp.getAffineMap();
-  } else {
-    auto storeOp = cast<AffineWriteOpInterface>(opInst);
-    map = storeOp.getAffineMap();
-  }
+  else
+    map = cast<AffineWriteOpInterface>(opInst).getAffineMap();
+
   SmallVector<Value, 8> operands(indices.begin(), indices.end());
   fullyComposeAffineMapAndOperands(&map, &operands);
   map = simplifyAffineMap(map);

diff  --git a/mlir/lib/Dialect/Affine/IR/AffineMemoryOpInterfaces.cpp b/mlir/lib/Dialect/Affine/IR/AffineMemoryOpInterfaces.cpp
index 6f5861efa956..33c1b3376d0a 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineMemoryOpInterfaces.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineMemoryOpInterfaces.cpp
@@ -1,4 +1,4 @@
-//===- AffineMemoryOpInterfaces.cpp - Loop-like operations in MLIR --------===//
+//===- AffineMemoryOpInterfaces.cpp ---------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.


        


More information about the Mlir-commits mailing list