[mlir][Affine] Minor clean-up of D79829
authorDiego Caballero <diego.caballero@intel.com>
Fri, 29 May 2020 21:31:03 +0000 (14:31 -0700)
committerDiego Caballero <diego.caballero@intel.com>
Fri, 29 May 2020 21:39:18 +0000 (14:39 -0700)
Addressing D79829 post-commit comments. Minor changes.

Reviewed By: rriddle

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

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

index f42fc25..1f4fdb6 100644 (file)
@@ -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_
index 8738000..dd174da 100644 (file)
@@ -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
index 7780627..f0bb4ca 100644 (file)
@@ -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)
index 8c48288..ca662c7 100644 (file)
@@ -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);
index 6f5861e..33c1b33 100644 (file)
@@ -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.