[Mlir-commits] [mlir] [MLIR] Add test to check that we don't reinit after running pass again (PR #151963)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Aug 4 06:37:09 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Will Froom (WillFroom)
<details>
<summary>Changes</summary>
Following on from #<!-- -->150948
---
Full diff: https://github.com/llvm/llvm-project/pull/151963.diff
1 Files Affected:
- (modified) mlir/test/CAPI/pass.c (+17)
``````````diff
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) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/151963
More information about the Mlir-commits
mailing list