[Mlir-commits] [mlir] [mlir] Fix liveness analysis (PR #88848)

Ivan Kulagin llvmlistbot at llvm.org
Mon May 13 08:50:53 PDT 2024


================
@@ -493,3 +493,68 @@ func.func @nested_region3(
   }
   return %1 : i32
 }
+
+// -----
+
+// CHECK-LABEL: Testing : nested_region4
+
+func.func @nested_region4(%arg0: index, %arg1: index, %arg2: index) {
+  // CHECK: Block: 0
+  // CHECK-NEXT: LiveIn:{{ *$}}
+  // CHECK-NEXT: LiveOut:{{ *$}}
+
+  // CHECK-NEXT: BeginLivenessIntervals
+  // CHECK-NEXT: [[VAL3:[a-z0-9_]+]]{{ *:}}
+  // CHECK-NEXT: %{{.*}} = arith.constant 0
+  // CHECK-NEXT: %{{.*}} = arith.constant 1
+  // CHECK-NEXT: %{{.*}} = scf.for
+  // COM:         Skipping the body of the scf.for...
+  // CHECK:      }
+
+  // CHECK-NEXT: [[VAL4:[a-z0-9_]+]]{{ *:}}
+  // CHECK-NEXT: %{{.*}} = arith.constant 1
+  // CHECK-NEXT: %{{.*}} = scf.for
+  // COM:         Skipping the body of the scf.for...
+  // CHECK:      }
+  // CHECK-NEXT: %{{.*}} = arith.addi %{{.*}}, %{{.*}} : {{[a-z0-9]}}
+
+  // CHECK-NEXT: [[VAL5:[a-z0-9_]+]]{{ *:}}
+  // CHECK-NEXT: %{{.*}} = scf.for
+  // COM:         Skipping the body of the scf.for...
+  // CHECK:      }
+  // CHECK-NEXT: EndLivenessIntervals
+
+  // CHECK-NEXT: BeginCurrentlyLive
+  // CHECK-NEXT: %{{.*}} = arith.constant 0
+  // CHECK-SAME: arg0 at 0 arg1 at 0 arg2 at 0 [[VAL3]]
+  // CHECK-NEXT: %{{.*}} = arith.constant 1
+  // CHECK-SAME: arg0 at 0 arg1 at 0 arg2 at 0 [[VAL3]] [[VAL4]]
+  // CHECK-NEXT: %{{.*}} = scf.for
+  // COM:          Skipping the body of the scf.for...
+  // CHECK:      }
+  // CHECK-SAME: arg0 at 0 arg1 at 0 arg2 at 0 [[VAL3]] [[VAL4]] [[VAL5]]
+  // CHECK-NEXT: EndCurrentlyLive
----------------
ikulagin wrote:

A check is most needed only for `LiveIn:{{ *$}}`, `LiveOut:{{ *$}}` for block 0 and `LiveIn: [[VAL4]]{{ *$}}`, `LiveOut:{{ *$}}` for block 1, but an anchor is needed for `VAL4`.

https://github.com/llvm/llvm-project/pull/88848


More information about the Mlir-commits mailing list