[PATCH] D72379: [mlir] Canonicalize static alloc followed by memref_cast and std.view

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 7 18:09:06 PST 2020


rriddle requested changes to this revision.
rriddle added inline comments.
This revision now requires changes to proceed.


================
Comment at: mlir/lib/Dialect/StandardOps/Ops.cpp:2538
+        dyn_cast_or_null<MemRefCastOp>(memrefOperand.getDefiningOp());
+    if (!memrefCastOp) {
+      return matchFailure();
----------------
Remove trivial braces.


================
Comment at: mlir/lib/Dialect/StandardOps/Ops.cpp:2546
+
+    auto newOperands = {viewOp.getOperands()[1], viewOp.getOperands()[2]};
+
----------------
Can you use named accessors for these instead?

Also, initializer_list is a temporary so this is likely to break. Use an array instead, or inline this into the 'replace' call below.


================
Comment at: mlir/test/Transforms/canonicalize.mlir:739
+  // Test: folding static alloc and memref_cast into a view.
+  // CHECK: std.view %0[][%c15, %c7] : memref<2048xi8> to memref<?x?xf32>
+  %6 = memref_cast %0 : memref<2048xi8> to memref<?xi8>
----------------
Don't check SSA names directly, they are not preserved.

https://mlir.llvm.org/getting_started/TestingGuide/


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72379





More information about the llvm-commits mailing list