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

John Paul Jepko llvmlistbot at llvm.org
Tue Mar 10 12:46:50 PDT 2026


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

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`.

>From 13ac37c014b5db5edf0a0c1c862fa94f626fc422 Mon Sep 17 00:00:00 2001
From: John Jepko <john.jepko at ericsson.com>
Date: Mon, 9 Mar 2026 22:37:24 +0100
Subject: [PATCH] Add better error msg

---
 mlir/lib/Pass/PassRegistry.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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();
 }



More information about the Mlir-commits mailing list