diff --git a/mlir/lib/Pass/PassRegistry.cpp b/mlir/lib/Pass/PassRegistry.cpp --- a/mlir/lib/Pass/PassRegistry.cpp +++ b/mlir/lib/Pass/PassRegistry.cpp @@ -452,12 +452,15 @@ function_ref errorHandler) const { for (auto &elt : elements) { if (elt.registryEntry) { - if (failed( - elt.registryEntry->addToPipeline(pm, elt.options, errorHandler))) - return failure(); + if (failed(elt.registryEntry->addToPipeline(pm, elt.options, + errorHandler))) { + return errorHandler("failed to add `" + elt.name + "` with options `" + + elt.options + "`"); + } } else if (failed(addToPipeline(elt.innerPipeline, pm.nest(elt.name), errorHandler))) { - return failure(); + return errorHandler("failed to add `" + elt.name + "` with options `" + + elt.options + "` to inner pipeline"); } } return success(); diff --git a/mlir/test/Pass/invalid-pass.mlir b/mlir/test/Pass/invalid-pass.mlir new file mode 100644 --- /dev/null +++ b/mlir/test/Pass/invalid-pass.mlir @@ -0,0 +1,6 @@ +// RUN: not mlir-opt %s -pass-pipeline='module(test-module-pass{test-option=a})' 2>&1 | FileCheck %s + +// CHECK: : no such option test-option +// CHECK: failed to add `test-module-pass` with options `test-option=a` +// CHECK: failed to add `module` with options `` to inner pipeline +module {}