[PATCH] D72935: [mlir] Add a canonicalization pattern for MemRefCastOp into dynamic MemRefs

Nagy Mostafa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 10:13:18 PST 2020


nmostafa added inline comments.


================
Comment at: mlir/lib/Dialect/StandardOps/Ops.cpp:1768
+                                     PatternRewriter &rewriter) const override {
+    MemRefType sourceType = castOp.source().getType().cast<MemRefType>();
+    AffineMap sourceMap = (sourceType.getAffineMaps().empty())
----------------
You need to handle or bailout on UnrankedMemRefType (and probably add a test for it). Also, the type propagation is only valid based on how the result is used : e.g. if a func argument, then the conversion is invalid. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72935





More information about the llvm-commits mailing list