[mlir][bufferize] Improve buffer writability analysis
authorMatthias Springer <springerm@google.com>
Tue, 7 Jun 2022 22:04:54 +0000 (00:04 +0200)
committerMatthias Springer <springerm@google.com>
Wed, 8 Jun 2022 08:11:52 +0000 (10:11 +0200)
commit032be2330928995ae264a4886fd2610bc3e49656
tree6931f466d5ed78211d8267260ca7aad5ee6a081c
parent0e10f1284455aaa54cbcad145238ecedd0d57e48
[mlir][bufferize] Improve buffer writability analysis

Find writability conflicts (writes to buffers that are not allowed to be written to) by checking SSA use-def chains. This is better than the current writability analysis, which is too conservative and finds false positives.

Differential Revision: https://reviews.llvm.org/D127256
mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h
mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-allow-return-allocs.mlir