[Mlir-commits] [mlir] [Transforms] Avoid repeated hash lookups (NFC) (PR #111470)
Kazu Hirata
llvmlistbot at llvm.org
Mon Oct 7 19:47:50 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/111470
None
>From e237ab433d381c6562647e4fff87a0bf40ca8897 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 7 Oct 2024 07:07:55 -0700
Subject: [PATCH] [Transforms] Avoid repeated hash lookups (NFC)
---
mlir/lib/Transforms/Utils/RegionUtils.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mlir/lib/Transforms/Utils/RegionUtils.cpp b/mlir/lib/Transforms/Utils/RegionUtils.cpp
index b7d26e88230946..e55ef6eb66b9c7 100644
--- a/mlir/lib/Transforms/Utils/RegionUtils.cpp
+++ b/mlir/lib/Transforms/Utils/RegionUtils.cpp
@@ -709,8 +709,7 @@ static SmallVector<SmallVector<Value, 8>, 2> pruneRedundantArguments(
DenseMap<Value, unsigned> firstValueToIdx;
for (unsigned j = 0; j < numArgs; ++j) {
Value newArg = newArguments[0][j];
- if (!firstValueToIdx.contains(newArg))
- firstValueToIdx[newArg] = j;
+ firstValueToIdx.try_emplace(newArg, j);
}
// Go through the first list of arguments (list 0).
More information about the Mlir-commits
mailing list