[Mlir-commits] [mlir] e509e87 - [SCF] Avoid repeated hash lookups (NFC) (#108793)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Sep 16 06:42:55 PDT 2024


Author: Kazu Hirata
Date: 2024-09-16T06:42:51-07:00
New Revision: e509e8777a26d586514d0129baa153f734ec14f7

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

LOG: [SCF] Avoid repeated hash lookups (NFC) (#108793)

Added: 
    

Modified: 
    mlir/lib/Dialect/SCF/IR/SCF.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/SCF/IR/SCF.cpp b/mlir/lib/Dialect/SCF/IR/SCF.cpp
index bfa7db84bd9af7..6d47ff3890977a 100644
--- a/mlir/lib/Dialect/SCF/IR/SCF.cpp
+++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp
@@ -4084,10 +4084,8 @@ static std::optional<SmallVector<unsigned>> getArgsMapping(ValueRange args1,
 static bool hasDuplicates(ValueRange args) {
   llvm::SmallDenseSet<Value> set;
   for (Value arg : args) {
-    if (set.contains(arg))
+    if (!set.insert(arg).second)
       return true;
-
-    set.insert(arg);
   }
   return false;
 }


        


More information about the Mlir-commits mailing list