[Mlir-commits] [mlir] [Shape] Avoid repeated hash lookups (NFC) (PR #108926)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Sep 16 21:28:07 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-shape

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/108926.diff


1 Files Affected:

- (modified) mlir/lib/Dialect/Shape/Transforms/OutlineShapeComputation.cpp (+1-3) 


``````````diff
diff --git a/mlir/lib/Dialect/Shape/Transforms/OutlineShapeComputation.cpp b/mlir/lib/Dialect/Shape/Transforms/OutlineShapeComputation.cpp
index f467123f9b33de..3297740a5f3ae6 100644
--- a/mlir/lib/Dialect/Shape/Transforms/OutlineShapeComputation.cpp
+++ b/mlir/lib/Dialect/Shape/Transforms/OutlineShapeComputation.cpp
@@ -292,10 +292,8 @@ void OutlineShapeComputationPass::getClusterFromValue(
       cluster.insert(op);
       for (Value inp : op->getOperands()) {
         Operation *inpDefOp = inp.getDefiningOp();
-        if (nullptr != inpDefOp && !visited.contains(inpDefOp)) {
-          visited.insert(inpDefOp);
+        if (nullptr != inpDefOp && visited.insert(inpDefOp).second)
           queue.push(inpDefOp);
-        }
       }
     }
   }

``````````

</details>


https://github.com/llvm/llvm-project/pull/108926


More information about the Mlir-commits mailing list