[PATCH] D73145: [mlir][Linalg] Introduce folding patterns to remove certain MemRefCastOp

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 11:10:07 PST 2020


rriddle added inline comments.


================
Comment at: mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:73
+  // canonicalize.
+  if (!resultType.getAffineMaps().empty() && sourceType != resultType)
+    return false;
----------------
When will this ever be hit? The desiredResultType doesn't appear to have any maps.


================
Comment at: mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:78
+  // TODO(ntv, rriddle): this may be a good use case for an OpInterface.
+  for (auto &u : castOp.getResult().getUses()) {
+    if (isa<LinalgOp>(u.getOwner()) || isa<SliceOp>(u.getOwner()))
----------------
nit: getUsers


================
Comment at: mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:102
+
+  if (sourceMap) {
+    int64_t offset;
----------------
nit: Can we use early exit here?


================
Comment at: mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1184
+// where a Linalg "named" op **isa** LinalgOp.
+LogicalResult ConvOp::fold(llvm::ArrayRef<mlir::Attribute>,
+                           llvm::SmallVectorImpl<mlir::OpFoldResult> &) {
----------------
Drop the llvm:: and mlir:: on all of these.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73145/new/

https://reviews.llvm.org/D73145





More information about the llvm-commits mailing list