diff --git a/mlir/test/lib/IR/TestVisitorsGeneric.cpp b/mlir/test/lib/IR/TestVisitorsGeneric.cpp --- a/mlir/test/lib/IR/TestVisitorsGeneric.cpp +++ b/mlir/test/lib/IR/TestVisitorsGeneric.cpp @@ -131,10 +131,8 @@ auto walker = [&](Block *block) { for (Operation &op : *block) - for (OpResult result : op.getResults()) - if (Operation *definingOp = result.getDefiningOp()) - if (definingOp->getAttrOfType("interrupt")) - return WalkResult::interrupt(); + if (op.getAttrOfType("interrupt")) + return WalkResult::interrupt(); llvm::outs() << "step " << stepNo++ << "\n"; return WalkResult::advance(); @@ -163,12 +161,9 @@ int stepNo = 0; auto walker = [&](Region *region) { - for (Block &block : *region) - for (Operation &op : block) - for (OpResult result : op.getResults()) - if (Operation *definingOp = result.getDefiningOp()) - if (definingOp->getAttrOfType("interrupt")) - return WalkResult::interrupt(); + for (Operation &op : region->getOps()) + if (op.getAttrOfType("interrupt")) + return WalkResult::interrupt(); llvm::outs() << "step " << stepNo++ << "\n"; return WalkResult::advance();