[all-commits] [llvm/llvm-project] 5829a9: [mlir][bufferization] Handle arith.select-based de...

Krish Gupta via All-commits all-commits at lists.llvm.org
Mon Jul 13 01:11:20 PDT 2026


  Branch: refs/heads/users/KrxGu/arith-select-dealloc
  Home:   https://github.com/llvm/llvm-project
  Commit: 5829a921c894d7f997533085dd918e7b60004c14
      https://github.com/llvm/llvm-project/commit/5829a921c894d7f997533085dd918e7b60004c14
  Author: KrxGu <krishom70 at gmail.com>
  Date:   2026-07-13 (Mon, 13 Jul 2026)

  Changed paths:
    M mlir/lib/Dialect/Bufferization/Transforms/StaticMemoryPlannerAnalysis.cpp

  Log Message:
  -----------
  [mlir][bufferization] Handle arith.select-based deallocs in static memory planner

Previously, allocs freed indirectly via arith.select chains were
skipped entirely. For example:
  %2 = arith.select %c, %0, %1
  memref.dealloc %2
would cause both %0 and %1 to be skipped with numSkipNoDealloc.

This patch adds select-chain traversal to collectCandidates. A group
constraint ensures that all allocs sharing a select-based dealloc are
either all eligible or all skipped - this prevents putting one alloc
into the arena while leaving its peer out, which would make the
select-dealloc invalid IR.

The lifetime computation is also improved: instead of one block scan
per candidate (O(n*m)), we now do a single scan upfront with a
DenseMap index. For select-based deallocs, timeEnd is conservatively
set to the latest dealloc that might free the alloc.

Tests: add cases for single-alloc select, shared select-dealloc, and
the two-select two-dealloc pattern from the mentor discussion.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list