[Mlir-commits] [mlir] [MLIR] Add test to check that we don't reinit after running pass again (PR #151963)
Will Froom
llvmlistbot at llvm.org
Mon Aug 4 06:36:35 PDT 2025
https://github.com/WillFroom created https://github.com/llvm/llvm-project/pull/151963
Following on from #150948
>From a20c9b99240d7c895015a6fa6e8848766a8f1f61 Mon Sep 17 00:00:00 2001
From: Will Froom <willfroom at google.com>
Date: Mon, 4 Aug 2025 13:34:58 +0000
Subject: [PATCH] [MLIR] Add test to check that we don't reinit after running
pass again
---
mlir/test/CAPI/pass.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/mlir/test/CAPI/pass.c b/mlir/test/CAPI/pass.c
index 3aad0016b393c..9907c64d12cfc 100644
--- a/mlir/test/CAPI/pass.c
+++ b/mlir/test/CAPI/pass.c
@@ -486,6 +486,23 @@ void testExternalPass(void) {
exit(EXIT_FAILURE);
}
+ // Run the pass again and confirm that the initializeCallCount is still 1.
+ MlirLogicalResult second_success = mlirPassManagerRunOnOp(pm, module);
+ if (mlirLogicalResultIsFailure(second_success)) {
+ fprintf(stderr, "Unexpected failure running external pass.\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (userData.initializeCallCount != 1) {
+ fprintf(stderr, "Expected initializeCallCount to be 1\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (userData.runCallCount != 2) {
+ fprintf(stderr, "Expected runCallCount to be 2\n");
+ exit(EXIT_FAILURE);
+ }
+
mlirPassManagerDestroy(pm);
if (userData.destructCallCount != userData.constructCallCount) {
More information about the Mlir-commits
mailing list