[Mlir-commits] [mlir] 4b1b450 - [Transforms] Avoid repeated hash lookups (NFC) (#108139)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Sep 11 06:40:23 PDT 2024


Author: Kazu Hirata
Date: 2024-09-11T06:40:17-07:00
New Revision: 4b1b450ae4b8fb9185f337c15315f4f473c3b429

URL: https://github.com/llvm/llvm-project/commit/4b1b450ae4b8fb9185f337c15315f4f473c3b429
DIFF: https://github.com/llvm/llvm-project/commit/4b1b450ae4b8fb9185f337c15315f4f473c3b429.diff

LOG: [Transforms] Avoid repeated hash lookups (NFC) (#108139)

Added: 
    

Modified: 
    mlir/lib/Transforms/Utils/DialectConversion.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 450e66f0db4e74..f288c7fc2cb77b 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -2486,9 +2486,8 @@ static void eraseDeadUnrealizedCasts(
 
     // Do not visit ops multiple times. If we find a circle, no live user was
     // found on the current path.
-    if (visited.contains(op))
+    if (!visited.insert(op).second)
       return false;
-    visited.insert(op);
 
     // Visit all users.
     for (Operation *user : op->getUsers()) {


        


More information about the Mlir-commits mailing list