diff --git a/mlir/lib/Pass/PassCrashRecovery.cpp b/mlir/lib/Pass/PassCrashRecovery.cpp --- a/mlir/lib/Pass/PassCrashRecovery.cpp +++ b/mlir/lib/Pass/PassCrashRecovery.cpp @@ -291,9 +291,9 @@ impl->activeContexts.back()->disable(); // Collect all of the parent scopes of this operation. - SmallVector scopes; + SmallVector scopes{op->getName()}; while (Operation *parentOp = op->getParentOp()) { - scopes.push_back(op->getName()); + scopes.push_back(parentOp->getName()); op = parentOp; } @@ -314,8 +314,10 @@ iterator_range passes, Operation *op) { std::string passStr; llvm::raw_string_ostream passOS(passStr); + passOS << op->getName() << "("; llvm::interleaveComma( passes, passOS, [&](Pass &pass) { pass.printAsTextualPipeline(passOS); }); + passOS << ")"; impl->activeContexts.push_back(std::make_unique( passOS.str(), op, impl->streamFactory, impl->pmFlagVerifyPasses)); @@ -470,9 +472,12 @@ } LogicalResult PassReproducerOptions::apply(PassManager &pm) const { - if (pipeline.has_value()) - if (failed(parsePassPipeline(*pipeline, pm))) + if (pipeline.has_value()) { + FailureOr reproPm = parsePassPipeline(*pipeline); + if (failed(reproPm)) return failure(); + static_cast(pm) = std::move(*reproPm); + } if (disableThreading.has_value()) pm.getContext()->disableMultithreading(*disableThreading); diff --git a/mlir/test/Pass/crash-recovery-dynamic-failure.mlir b/mlir/test/Pass/crash-recovery-dynamic-failure.mlir --- a/mlir/test/Pass/crash-recovery-dynamic-failure.mlir +++ b/mlir/test/Pass/crash-recovery-dynamic-failure.mlir @@ -15,4 +15,4 @@ // REPRO_LOCAL_DYNAMIC_FAILURE: module @inner_mod1 // REPRO_LOCAL_DYNAMIC_FAILURE: module @foo { -// REPRO_LOCAL_DYNAMIC_FAILURE: pipeline: "builtin.module(test-pass-failure)" +// REPRO_LOCAL_DYNAMIC_FAILURE: pipeline: "builtin.module(builtin.module(test-pass-failure))" diff --git a/mlir/test/Pass/crash-recovery.mlir b/mlir/test/Pass/crash-recovery.mlir --- a/mlir/test/Pass/crash-recovery.mlir +++ b/mlir/test/Pass/crash-recovery.mlir @@ -22,12 +22,12 @@ // REPRO: module @inner_mod1 // REPRO: module @foo { -// REPRO: pipeline: "builtin.module(test-module-pass,test-pass-crash)" +// REPRO: pipeline: "builtin.module(builtin.module(test-module-pass,test-pass-crash))" // REPRO_LOCAL: module @inner_mod1 // REPRO_LOCAL: module @foo { -// REPRO_LOCAL: pipeline: "builtin.module(test-pass-crash)" +// REPRO_LOCAL: pipeline: "builtin.module(builtin.module(test-pass-crash))" // REPRO_LOCAL_DYNAMIC: module @inner_mod1 // REPRO_LOCAL_DYNAMIC: module @foo { -// REPRO_LOCAL_DYNAMIC: pipeline: "builtin.module(test-pass-crash)" +// REPRO_LOCAL_DYNAMIC: pipeline: "builtin.module(builtin.module(test-pass-crash))" diff --git a/mlir/test/Pass/run-reproducer.mlir b/mlir/test/Pass/run-reproducer.mlir --- a/mlir/test/Pass/run-reproducer.mlir +++ b/mlir/test/Pass/run-reproducer.mlir @@ -1,3 +1,4 @@ +// RUN: mlir-opt %s -test-dump-pipeline |& FileCheck %s // RUN: mlir-opt %s -mlir-print-ir-before=cse 2>&1 | FileCheck -check-prefix=BEFORE %s func.func @foo() { @@ -12,7 +13,9 @@ {-# external_resources: { mlir_reproducer: { - pipeline: "func.func(cse,canonicalize)", + verify_each: true, + // CHECK: builtin.module(func.func(cse,canonicalize{ max-iterations=1 region-simplify=false top-down=false})) + pipeline: "builtin.module(func.func(cse,canonicalize{max-iterations=1 region-simplify=false top-down=false}))", disable_threading: true } }