Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion mlir/test/Analysis/DataFlow/test-liveness-analysis.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,18 @@ func.func private @private0(%0 : i32) -> i32 {
// CHECK-NEXT: result #0: live
// CHECK-LABEL: test_tag: y:
// CHECK-NEXT: result #0: not live
// CHECK-LABEL: test_tag: for:
// CHECK-NEXT: operand #0: live
// CHECK-NEXT: operand #1: live
// CHECK-NEXT: operand #2: live
// CHECK-NEXT: operand #3: live
// CHECK-NEXT: operand #4: not live
// CHECK-NEXT: result #0: live
// CHECK-NEXT: result #1: not live
// CHECK-NEXT: region: #0:
// CHECK-NEXT: argument: #0: live
// CHECK-NEXT: argument: #1: not live
// CHECK-NEXT: argument: #2: not live
func.func @test_7_type_3(%arg0: memref<i32>) {
%c0 = arith.constant {tag = "zero"} 0 : index
%c10 = arith.constant {tag = "ten"} 10 : index
Expand All @@ -194,7 +206,7 @@ func.func @test_7_type_3(%arg0: memref<i32>) {
%1 = arith.addi %x, %x : i32
%2 = func.call @private0(%1) : (i32) -> i32
scf.yield %2, %arg3 : i32, i32
}
} {tag = "for"}
memref.store %0#0, %arg0[] : memref<i32>
return
}
Expand Down
11 changes: 11 additions & 0 deletions mlir/test/lib/Analysis/DataFlow/TestLivenessAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ struct TestLivenessAnalysisPass
liveness->print(os);
os << "\n";
}
for (auto [regionIndex, region] : llvm::enumerate(op->getRegions())) {
os << " region: #" << regionIndex << ":\n";
for (auto [argumntIndex, argument] :
llvm::enumerate(region.getArguments())) {
const Liveness *liveness = livenessAnalysis.getLiveness(argument);
assert(liveness && "expected a sparse lattice");
os << " argument: #" << argumntIndex << ": ";
liveness->print(os);
os << "\n";
}
}
});
}
};
Expand Down