[Mlir-commits] [mlir] 179588e - [mlir] remove unnecessary statements in test

Ashay Rane llvmlistbot at llvm.org
Fri Jul 15 18:57:13 PDT 2022


Author: Ashay Rane
Date: 2022-07-15T18:57:07-07:00
New Revision: 179588ea3951a81feff57990e7ce7bd38181026d

URL: https://github.com/llvm/llvm-project/commit/179588ea3951a81feff57990e7ce7bd38181026d
DIFF: https://github.com/llvm/llvm-project/commit/179588ea3951a81feff57990e7ce7bd38181026d.diff

LOG: [mlir] remove unnecessary statements in test

A previous commit (f2b94bd) added some unnecessary statements that
dereferenced operations only to get the operations back.  This patch
removes the unnecessary statements.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D129913

Added: 
    

Modified: 
    mlir/test/lib/IR/TestVisitorsGeneric.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/test/lib/IR/TestVisitorsGeneric.cpp b/mlir/test/lib/IR/TestVisitorsGeneric.cpp
index 833d6294db525..00148df26e351 100644
--- a/mlir/test/lib/IR/TestVisitorsGeneric.cpp
+++ b/mlir/test/lib/IR/TestVisitorsGeneric.cpp
@@ -131,10 +131,8 @@ struct TestGenericIRBlockVisitorInterruptPass
 
     auto walker = [&](Block *block) {
       for (Operation &op : *block)
-        for (OpResult result : op.getResults())
-          if (Operation *definingOp = result.getDefiningOp())
-            if (definingOp->getAttrOfType<BoolAttr>("interrupt"))
-              return WalkResult::interrupt();
+        if (op.getAttrOfType<BoolAttr>("interrupt"))
+          return WalkResult::interrupt();
 
       llvm::outs() << "step " << stepNo++ << "\n";
       return WalkResult::advance();
@@ -163,12 +161,9 @@ struct TestGenericIRRegionVisitorInterruptPass
     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<BoolAttr>("interrupt"))
-                return WalkResult::interrupt();
+      for (Operation &op : region->getOps())
+        if (op.getAttrOfType<BoolAttr>("interrupt"))
+          return WalkResult::interrupt();
 
       llvm::outs() << "step " << stepNo++ << "\n";
       return WalkResult::advance();


        


More information about the Mlir-commits mailing list