[Mlir-commits] [mlir] [mlir][Pass] Report error when passing options to pipelines via shorthand syntax (PR #185738)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Mar 10 12:47:45 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: John Paul Jepko (jpjepko)

<details>
<summary>Changes</summary>

When passing options to a pass pipeline that doesn't accept options, mlir-opt exits with error code 1, but prints no error message when using shorthand CLI syntax:

```
# Silent failure (no error message):
$ mlir-opt --tosa-to-linalg-pipeline=foo /dev/null
$ echo $?
1

# Same pipeline via --pass-pipeline syntax reports error:
$ mlir-opt --pass-pipeline='builtin.module(tosa-to-linalg-pipeline{foo})' /dev/null
<unknown>:0: error: failed to add `tosa-to-linalg-pipeline` with options `foo`
```

This PR adds replaces the silent call to `failure` with `errorHandler` in `PassPipelineCLParser::addToPipeline`, matching the existing pattern in `TextualPipeline::addToPipeline`.

---
Full diff: https://github.com/llvm/llvm-project/pull/185738.diff


1 Files Affected:

- (modified) mlir/lib/Pass/PassRegistry.cpp (+3-1) 


``````````diff
diff --git a/mlir/lib/Pass/PassRegistry.cpp b/mlir/lib/Pass/PassRegistry.cpp
index d14d49aac9898..66fbe68af6538 100644
--- a/mlir/lib/Pass/PassRegistry.cpp
+++ b/mlir/lib/Pass/PassRegistry.cpp
@@ -1022,7 +1022,9 @@ LogicalResult PassPipelineCLParser::addToPipeline(
   for (auto &passIt : impl->passList) {
     if (failed(passIt.registryEntry->addToPipeline(pm, passIt.options,
                                                    errorHandler)))
-      return failure();
+      return errorHandler("failed to add `" +
+                          passIt.registryEntry->getPassArgument() +
+                          "` with options `" + passIt.options + "`");
   }
   return success();
 }

``````````

</details>


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


More information about the Mlir-commits mailing list