[mlir] Properly handle recursive bufferization for scf.for/scf.if
authorSean Silva <silvasean@google.com>
Mon, 26 Oct 2020 23:46:54 +0000 (16:46 -0700)
committerSean Silva <silvasean@google.com>
Wed, 28 Oct 2020 21:16:56 +0000 (14:16 -0700)
commit1ce7040359a92a63b7b8cda2b6635627a4428399
treee754de0babfd836d627bb5f76f372a52efe869fc
parent35d226911165a9aae1f01f521a0019f1a9c0a25f
[mlir] Properly handle recursive bufferization for scf.for/scf.if

This fixes a subtle issue, described in the comment starting with
"Clone the op without the regions and inline the regions from the old op",
which prevented this conversion from working on non-trivial examples.

Differential Revision: https://reviews.llvm.org/D90203
mlir/lib/Dialect/SCF/Transforms/Bufferize.cpp
mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp
mlir/test/Dialect/SCF/bufferize.mlir