[mlir][tensor][bufferize] Fix tensor.insert_slice regression
authorMatthias Springer <springerm@google.com>
Sat, 26 Nov 2022 14:34:03 +0000 (15:34 +0100)
committerMatthias Springer <springerm@google.com>
Sat, 26 Nov 2022 18:14:33 +0000 (19:14 +0100)
commit13593dc9dc5a8f587402bf1e5f180f2c0fc750ee
tree3cf4a0adb8ce01aee12c318c702ab9459be82437
parenta737146c9252e13233775cec3eeb6a09f9960437
[mlir][tensor][bufferize] Fix tensor.insert_slice regression

This reverts D132662 (apart from overall cleanups), which introduced a too aggressive optimization for tensor.insert_slice bufferization. Instead, bufferizesToMemoryRead is improved to handle some of these cases. The remaining cases can still bufferize efficiently when running the canonicalizer before the bufferization.

Differential Revision: https://reviews.llvm.org/D138745
mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp
mlir/test/Dialect/Tensor/one-shot-bufferize.mlir