[PATCH] D74342: [mlir] Add MemRef filter to affine data copy optimization

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 10 22:37:24 PST 2020


rriddle added inline comments.


================
Comment at: mlir/lib/Transforms/Utils/LoopUtils.cpp:1636
     if (auto loadOp = dyn_cast<AffineLoadOp>(opInst)) {
-      if ((loadOp.getMemRefType().getMemorySpace() !=
+      if ((filterMemRef.hasValue() &&
+           filterMemRef.getValue() != loadOp.getMemRef()) ||
----------------
You can just do `filterMemRef != loadOp.getMemRef()`


================
Comment at: mlir/lib/Transforms/Utils/LoopUtils.cpp:1642
     } else if (auto storeOp = dyn_cast<AffineStoreOp>(opInst)) {
-      if (storeOp.getMemRefType().getMemorySpace() !=
-          copyOptions.slowMemorySpace)
+      if ((filterMemRef.hasValue() &&
+           filterMemRef.getValue() != storeOp.getMemRef()) ||
----------------
Same here.


================
Comment at: mlir/lib/Transforms/Utils/LoopUtils.cpp:1803
+    DenseMap<unsigned, SmallVector<AffineForOp, 2>> &depthToLoops) {
+  for (auto &block : func) {
+    gatherLoops(&block, /*currLoopDepth=*/0, depthToLoops);
----------------
Drop trivial braces.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74342





More information about the llvm-commits mailing list