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

Kazu Hirata llvmlistbot at llvm.org
Mon Sep 16 21:27:34 PDT 2024


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

None

>From 2ded2d0bd6533def44f49eeb1cf11c8e2fc97789 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 16 Sep 2024 06:49:42 -0700
Subject: [PATCH] [Shape] Avoid repeated hash lookups (NFC)

---
 mlir/lib/Dialect/Shape/Transforms/OutlineShapeComputation.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

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);
-        }
       }
     }
   }



More information about the Mlir-commits mailing list