[Mlir-commits] [mlir] [mlir] Fix liveness analysis (PR #88848)
Maksim Levental
llvmlistbot at llvm.org
Thu Apr 18 11:19:13 PDT 2024
makslevental wrote:
For added context, prior to this change
```
// mlir-opt -pass-pipeline="builtin.module(func.func(test-print-liveness))" testliveness.mlir
module {
func.func @test() {
%alloc = memref.alloc() : memref<16xf16>
%c0 = arith.constant 0 : index
%c10 = arith.constant 10 : index
%c1 = arith.constant 1 : index
%0 = scf.for %arg1 = %c0 to %c10 step %c1 iter_args(%arg2 = %alloc) -> memref<16xf16> {
scf.yield %arg2 : memref<16xf16>
}
return
}
}
```
gives
```
Testing : test
// ---- Liveness -----
// - Block: 0
// --- LiveIn: arg1 at 1
// --- LiveOut:
// --- BeginLivenessIntervals
// val_0 :
// %alloc = memref.alloc() : memref<16xf16>
// %c0 = arith.constant 0 : index
// %c10 = arith.constant 10 : index
// %c1 = arith.constant 1 : index
// %0 = scf.for %arg0 = %c0 to %c10 step %c1 iter_args(%arg1 = %alloc) -> (memref<16xf16>) {
scf.yield %arg1 : memref<16xf16>
}
// val_1 :
// %c0 = arith.constant 0 : index
// %c10 = arith.constant 10 : index
// %c1 = arith.constant 1 : index
// %0 = scf.for %arg0 = %c0 to %c10 step %c1 iter_args(%arg1 = %alloc) -> (memref<16xf16>) {
scf.yield %arg1 : memref<16xf16>
}
// val_2 :
// %c10 = arith.constant 10 : index
// %c1 = arith.constant 1 : index
// %0 = scf.for %arg0 = %c0 to %c10 step %c1 iter_args(%arg1 = %alloc) -> (memref<16xf16>) {
scf.yield %arg1 : memref<16xf16>
}
// val_3 :
// %c1 = arith.constant 1 : index
// %0 = scf.for %arg0 = %c0 to %c10 step %c1 iter_args(%arg1 = %alloc) -> (memref<16xf16>) {
scf.yield %arg1 : memref<16xf16>
}
// val_4 :
// %0 = scf.for %arg0 = %c0 to %c10 step %c1 iter_args(%arg1 = %alloc) -> (memref<16xf16>) {
scf.yield %arg1 : memref<16xf16>
}
// --- EndLivenessIntervals
// --- BeginCurrentlyLive
// %alloc = memref.alloc() : memref<16xf16> [val_0 arg1 at 1]
// %c0 = arith.constant 0 : index [val_0 val_1 arg1 at 1]
// %c10 = arith.constant 10 : index [val_0 val_1 val_2 arg1 at 1]
// %c1 = arith.constant 1 : index [val_0 val_1 val_2 val_3 arg1 at 1]
// %0 = scf.for %arg0 = %c0 to %c10 step %c1 iter_args(%arg1 = %alloc) -> (memref<16xf16>) {
scf.yield %arg1 : memref<16xf16>
} [val_0 val_1 val_2 val_3 val_4 arg1 at 1]
// --- EndCurrentlyLive
// - Block: 1
// --- LiveIn:
// --- LiveOut:
// --- BeginLivenessIntervals
// --- EndLivenessIntervals
// --- BeginCurrentlyLive
// scf.yield %arg1 : memref<16xf16> [arg0 at 1 arg1 at 1]
// --- EndCurrentlyLive
// -------------------
```
https://github.com/llvm/llvm-project/pull/88848
More information about the Mlir-commits
mailing list