@@ -21,17 +21,17 @@ namespace mlir {
2121#include " mlir/Dialect/SCF/Transforms/Passes.h.inc"
2222} // namespace mlir
2323
24+ #define DEBUG_TYPE " parallel-for-to-nested-fors"
2425using namespace mlir ;
2526
2627FailureOr<scf::LoopNest>
2728mlir::scf::parallelForToNestedFors (RewriterBase &rewriter,
2829 scf::ParallelOp parallelOp) {
2930
30- if (!parallelOp.getResults ().empty ()) {
31- parallelOp->emitError (" Currently scf.parallel to scf.for conversion "
32- " doesn't support scf.parallel with results." );
33- return failure ();
34- }
31+ if (!parallelOp.getResults ().empty ())
32+ return rewriter.notifyMatchFailure (
33+ parallelOp, " Currently scf.parallel to scf.for conversion doesn't "
34+ " support scf.parallel with results." );
3535
3636 rewriter.setInsertionPoint (parallelOp);
3737
@@ -66,11 +66,17 @@ struct ParallelForToNestedFors final
6666 Operation *parentOp = getOperation ();
6767 IRRewriter rewriter (parentOp->getContext ());
6868
69- parentOp->walk ([&](scf::ParallelOp parallelOp) {
70- if (failed (scf::parallelForToNestedFors (rewriter, parallelOp))) {
71- return signalPassFailure ();
72- }
73- });
69+ parentOp->walk (
70+ [&](scf::ParallelOp parallelOp) {
71+ if (failed (scf::parallelForToNestedFors (rewriter, parallelOp))) {
72+ LLVM_DEBUG (
73+ llvm::dbgs ()
74+ << " Failed to convert scf.parallel to nested scf.for ops for:\n "
75+ << parallelOp << " \n " );
76+ return WalkResult::advance ();
77+ }
78+ return WalkResult::advance ();
79+ });
7480 }
7581};
7682} // namespace
0 commit comments