[mlir][linalg][bufferize] LinalgOp: Move existing region to new op
authorMatthias Springer <springerm@google.com>
Thu, 6 Jan 2022 21:59:45 +0000 (06:59 +0900)
committerMatthias Springer <springerm@google.com>
Thu, 6 Jan 2022 22:00:24 +0000 (07:00 +0900)
commit42fd68b34457f4d07c052cca6f490054ec2e215c
tree6d639e9714fc0f6e66a1baa033dd103bf1a91742
parenta5af260d3e8b00a3353e813b73f83391edbef493
[mlir][linalg][bufferize] LinalgOp: Move existing region to new op

This has two advantages.

1. It is more efficient. No need to clone the entire region.
2. Recreating ops (via cloning) invalidates analysis results. Previously, an OpResult could have bufferized out-of-place, even though the analysis requested an in-place bufferization. That is because BufferizationState keeps track of OpResults for storing bufferization analysis results (and cloned ops have new OpResults).

Differential Revision: https://reviews.llvm.org/D116453
mlir/lib/Dialect/Linalg/ComprehensiveBufferize/LinalgInterfaceImpl.cpp