[mlir][linalg][bufferize] Eliminate InitTensorOps of InsertSliceOp sources
authorMatthias Springer <springerm@google.com>
Thu, 21 Oct 2021 12:33:07 +0000 (21:33 +0900)
committerMatthias Springer <springerm@google.com>
Thu, 21 Oct 2021 12:33:45 +0000 (21:33 +0900)
commitc5501a7a5c582168d1b12335c092bce53b32022d
tree05e712f1fe4c776683295088a80d0ecaabd930dc
parent7ff4f48adb26429086d6fd85a14336e57cd340dc
[mlir][linalg][bufferize] Eliminate InitTensorOps of InsertSliceOp sources

An InitTensorOp is replaced with an ExtractSliceOp on the InsertSliceOp's destination. This optimization is applied after analysis and only to InsertSliceOps that were decided to bufferize inplace. Another analysis on the new ExtractSliceOp is needed after the rewrite.

Differential Revision: https://reviews.llvm.org/D111955
mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp
mlir/test/Dialect/Linalg/comprehensive-module-bufferize-analysis.mlir
mlir/test/Dialect/Linalg/comprehensive-module-bufferize.mlir