[Mlir-commits] [mlir] 4431331 - [MLIR] Add test to check that we don't reinit after running pass again (#151963)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Aug 4 06:51:02 PDT 2025


Author: Will Froom
Date: 2025-08-04T14:50:58+01:00
New Revision: 4431331cb6b0a3327adbd49b49792f693f868866

URL: https://github.com/llvm/llvm-project/commit/4431331cb6b0a3327adbd49b49792f693f868866
DIFF: https://github.com/llvm/llvm-project/commit/4431331cb6b0a3327adbd49b49792f693f868866.diff

LOG: [MLIR] Add test to check that we don't reinit after running pass again (#151963)

Following on from #150948

Added: 
    

Modified: 
    mlir/test/CAPI/pass.c

Removed: 
    


################################################################################
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