[Mlir-commits] [mlir] [SCF] Avoid repeated hash lookups (NFC) (PR #108793)
Kazu Hirata
llvmlistbot at llvm.org
Sun Sep 15 23:42:05 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/108793
None
>From 27fd3a9a08484acbc444911a89da30c0f18234ea Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 15 Sep 2024 10:07:57 -0700
Subject: [PATCH] [SCF] Avoid repeated hash lookups (NFC)
---
mlir/lib/Dialect/SCF/IR/SCF.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
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