[Mlir-commits] [mlir] [Transforms] Avoid repeated hash lookups (NFC) (PR #111470)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Oct 7 19:48:24 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-core
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/111470.diff
1 Files Affected:
- (modified) mlir/lib/Transforms/Utils/RegionUtils.cpp (+1-2)
``````````diff
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).
``````````
</details>
https://github.com/llvm/llvm-project/pull/111470
More information about the Mlir-commits
mailing list