[mlir] Add error message when failing to add pass

Ran into failure without any error message previously here.

Differential Revision: https://reviews.llvm.org/D93910
This commit is contained in:
Jacques Pienaar 2020-12-29 14:20:19 -08:00
parent 14056c88d6
commit 5fd2b3a124
2 changed files with 13 additions and 4 deletions

View File

@ -452,12 +452,15 @@ LogicalResult TextualPipeline::addToPipeline(
function_ref<LogicalResult(const Twine &)> 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();

View File

@ -0,0 +1,6 @@
// RUN: not mlir-opt %s -pass-pipeline='module(test-module-pass{test-option=a})' 2>&1 | FileCheck %s
// CHECK: <Pass-Options-Parser>: 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 {}