[mlir][bufferization] Handle scf.if deallocs in static memory planner (#213634)

Extends the static memory planner (#209106) to handle two scf.if
patterns that previously errored or were silently missed.

**What changed**

Replaced the hand-rolled `BufferViewFlowOpInterface` DFS with the shared
`BufferViewFlowAnalysis`. This covers arith.select, scf.if/for results,
cf branches, and view ops in one place — no new interface needed.

Two new cases are handled:

1. Alloc flows through an `scf.if` result; `dealloc` is on that result.
`resolve()` finds the alias and picks up the dealloc.

2. Alloc is in the entry block; `dealloc` is inside an `scf.if` body.
`findAncestorOpInBlock` anchors the lifetime to the enclosing `scf.if` —
conservative but correct.

A reverse-alias guard (`resolveReverse`) handles the unsafe case where a
dealloc may also free a *nested* alloc not managed by the arena. That
alloc is conservatively skipped rather than miscompiled.

**Test changes**

- Tests 11–14 added: scf.if nested dealloc, scf.if result alias, nested
alloc skip, shared-dealloc conservative skip.
- Error test 2 updated: scf.if-nested dealloc is now valid, replaced
with a `cf.br` sibling-block escaping case.

GitOrigin-RevId: 02960166f1a6814c0efc1c22417b5ab0ff37801e
4 files changed
tree: 25dbb181dbc1cbd6728e2e0d4f76f47fc0d89a3e
  1. benchmark/
  2. cmake/
  3. docs/
  4. examples/
  5. include/
  6. lib/
  7. python/
  8. test/
  9. tools/
  10. unittests/
  11. utils/
  12. .clang-format
  13. .clang-tidy
  14. CMakeLists.txt
  15. LICENSE.TXT
  16. Maintainers.md
  17. README.md
README.md

Multi-Level Intermediate Representation

See https://mlir.llvm.org/ for more information.