[mlir][linalg][bufferize] Support scf::IfOp
authorMatthias Springer <springerm@google.com>
Fri, 22 Oct 2021 00:58:41 +0000 (09:58 +0900)
committerMatthias Springer <springerm@google.com>
Fri, 22 Oct 2021 01:12:55 +0000 (10:12 +0900)
commit3bbc869e2ef26f3bc296d5b4e23ee8678a20fc0b
treeca83c4941b366b78935bec27e99be8fc430e2b27
parent4976be1e955d2f5ebd4e28df07235d86e9228e09
[mlir][linalg][bufferize] Support scf::IfOp

This commit adds support for scf::IfOp to comprehensive bufferization. Support is currently limited to cases where both branches yield tensors that bufferize to the same buffer.

To keep the analysis simple, scf::IfOp are treated as memory writes for analysis purposes, even if no op inside any branch is writing. (scf::ForOps are handled in the same way.)

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