diff --git a/mlir/lib/IR/Visitors.cpp b/mlir/lib/IR/Visitors.cpp --- a/mlir/lib/IR/Visitors.cpp +++ b/mlir/lib/IR/Visitors.cpp @@ -114,7 +114,8 @@ } for (auto &block : region) { for (auto &nestedOp : block) - walk(&nestedOp, callback, order); + if (walk(&nestedOp, callback, order).wasInterrupted()) + return WalkResult::interrupt(); } if (order == WalkOrder::PostOrder) { if (callback(®ion).wasInterrupted()) @@ -140,7 +141,8 @@ return WalkResult::interrupt(); } for (auto &nestedOp : block) - walk(&nestedOp, callback, order); + if (walk(&nestedOp, callback, order).wasInterrupted()) + return WalkResult::interrupt(); if (order == WalkOrder::PostOrder) { if (callback(&block).wasInterrupted()) return WalkResult::interrupt();