[Mlir-commits] [mlir] [mlir][dataflow] Add visitBranchRegionArgument interface to SparseBackwardDataFlowAnalysis and apply it in LivenessAnalysis/RemoveDeadValues (PR #169816)
Matthias Springer
llvmlistbot at llvm.org
Thu Nov 27 19:49:09 PST 2025
================
@@ -166,25 +165,6 @@ void LivenessAnalysis::visitBranchOperand(OpOperand &operand) {
blocks.push_back(&block);
}
}
-
- // In the block of the successor block argument of RegionBranchOpInterface,
----------------
matthias-springer wrote:
This comment explicitly mentions the IV of `scf.for`. Shouldn't this also cover the IV of `affine.for`? Why is this broken for `affine.for` but not `scf.for`?
I tried running this IR (without your patch):
```mlir
// RUN: mlir-opt %s -test-liveness-analysis
func.func @affine_for() {
%c1 = arith.constant 1 : index
%alloc = memref.alloc() : memref<10xindex>
affine.for %arg0 = 0 to 79 {
memref.store %c1, %alloc[%c1] : memref<10xindex>
} {tag = "affine.for"}
return
}
func.func @scf_for(%lb: index, %ub: index, %step: index) {
%c1 = arith.constant 1 : index
%alloc = memref.alloc() : memref<10xindex>
scf.for %arg0 = %lb to %ub step %step {
memref.store %c1, %alloc[%c1] : memref<10xindex>
} {tag = "scf.for"}
return
}
```
And this is the output that I am seeing:
```
test_tag: affine.for:
region: #0:
argument: #0: not live <-- affine.for IV
test_tag: scf.for:
operand #0: live
operand #1: live
operand #2: live
region: #0:
argument: #0: live <-- scf.for IV
```
Can you make sense of this?
https://github.com/llvm/llvm-project/pull/169816
More information about the Mlir-commits
mailing list