The previous code was a bit too eager in canonicalizing.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I think this should become a pass instead, so that it can also consider aliases and
remove more clones. Block local aliases would suffice to catch situations like
%931 = memref.reshape %930(%107) : (memref<*xf16>, memref<?xindex>) -> memref<*xf16> %932 = memref.clone %931 : memref<*xf16> to memref<*xf16> memref.dealloc %930 : memref<*xf16>
Hey @dfki-jugr. I debugged this a bit today and here is how far I got. We can either land this as a cleanup or you can fold it into some changes you want to do anyway.
mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp | ||
---|---|---|
537 | This is a dangerous folding, as it means that a clone can change a memref's type. One then has to take care of this in all patterns that want to drop a clone. I'd rather just keep the casting behavior separate. | |
mlir/lib/Transforms/BufferDeallocation.cpp | ||
154 | This is a unrelated minor bug. |
mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp | ||
---|---|---|
508 | We should drop the earlier one, right? I won't add this now, maybe as a follow up. |
Can we drop the last one in the block in this case?