[MLIR][memref] Fix findDealloc() to handle > 1 dealloc for the given alloc.
authorRahul Joshi <jurahul@google.com>
Thu, 22 Jul 2021 00:13:40 +0000 (17:13 -0700)
committerRahul Joshi <jurahul@google.com>
Thu, 22 Jul 2021 16:34:19 +0000 (09:34 -0700)
commitf8d3755f00b8228d1441429dcd63af45f59ce164
tree6b592a8c397d2bad8503d1cfa1e99cbae88c44b2
parent1a965706219efd40c7e2548e317311266187bb09
[MLIR][memref] Fix findDealloc() to handle > 1 dealloc for the given alloc.

- Change findDealloc() to return Optional<Operation *> and return None if > 1
  dealloc is associated with the given alloc.
- Add findDeallocs() to return all deallocs associated with the given alloc.
- Fix current uses of findDealloc() to bail out if > 1 dealloc is found.

Differential Revision: https://reviews.llvm.org/D106456
mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
mlir/include/mlir/Dialect/MemRef/Utils/MemRefUtils.h
mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
mlir/lib/Dialect/MemRef/Utils/MemRefUtils.cpp
mlir/lib/Transforms/BufferUtils.cpp
mlir/test/Dialect/MemRef/canonicalize.mlir