[mlir] Add a simplifying wrapper for generateCopy and expose it.
authorTim Shen <timshen@google.com>
Tue, 10 Mar 2020 22:32:53 +0000 (15:32 -0700)
committerTim Shen <timshen@google.com>
Wed, 11 Mar 2020 23:22:31 +0000 (16:22 -0700)
commitd00f5632f39e101b1679ef887b03c566c4400d19
tree8839993358319ff849a4e7f4862ded62970c9063
parentd4757a6cf104ae57c27b915fb6dd424a1992c146
[mlir] Add a simplifying wrapper for generateCopy and expose it.

Summary:
affineDataCopyGenerate is a monolithinc function that
combines several steps for good reasons, but it makes customizing
the behaivor even harder. The major two steps by affineDataCopyGenerate are:
a) Identify interesting memrefs and collect their uses.
b) Create new buffers to forward these uses.

Step (a) actually has requires tremendous customization options. One could see
that from the recently added filterMemRef parameter.

This patch adds a function that only does (b), in the hope that (a)
can be directly implemented by the callers. In fact, (a) is quite
simple if the caller has only one buffer to consider, or even one use.

Differential Revision: https://reviews.llvm.org/D75965
mlir/include/mlir/Transforms/LoopUtils.h
mlir/lib/Transforms/Utils/LoopUtils.cpp
mlir/test/Transforms/affine-data-copy.mlir
mlir/test/lib/Transforms/TestAffineDataCopy.cpp