[Mlir-commits] [mlir] 85c97c1 - [Bytecode] Avoid repeated hash lookups (NFC) (#108320)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Sep 12 00:51:41 PDT 2024
Author: Kazu Hirata
Date: 2024-09-12T00:51:38-07:00
New Revision: 85c97c1cec63da27d9f16b0b7c44d65a0e3da0a4
URL: https://github.com/llvm/llvm-project/commit/85c97c1cec63da27d9f16b0b7c44d65a0e3da0a4
DIFF: https://github.com/llvm/llvm-project/commit/85c97c1cec63da27d9f16b0b7c44d65a0e3da0a4.diff
LOG: [Bytecode] Avoid repeated hash lookups (NFC) (#108320)
Added:
Modified:
mlir/lib/Bytecode/Reader/BytecodeReader.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
index a57b2178aec707..e9de3062d41c70 100644
--- a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
+++ b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
@@ -2017,10 +2017,9 @@ LogicalResult BytecodeReader::Impl::sortUseListOrder(Value value) {
DenseSet<unsigned> set;
uint64_t accumulator = 0;
for (const auto &elem : shuffle) {
- if (set.contains(elem))
+ if (!set.insert(elem).second)
return failure();
accumulator += elem;
- set.insert(elem);
}
if (numUses != shuffle.size() ||
accumulator != (((numUses - 1) * numUses) >> 1))
More information about the Mlir-commits
mailing list