[llvm] bc7e5c2 - [SLP] Avoid repeated hash lookups (NFC) (#115428)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 8 07:35:09 PST 2024
Author: Kazu Hirata
Date: 2024-11-08T07:35:06-08:00
New Revision: bc7e5c2016e287b768d2a3a1de15f6bb644622ae
URL: https://github.com/llvm/llvm-project/commit/bc7e5c2016e287b768d2a3a1de15f6bb644622ae
DIFF: https://github.com/llvm/llvm-project/commit/bc7e5c2016e287b768d2a3a1de15f6bb644622ae.diff
LOG: [SLP] Avoid repeated hash lookups (NFC) (#115428)
Added:
Modified:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index c5b3537bc57bcb..a6accf0318a30f 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -2241,10 +2241,9 @@ class BoUpSLP {
HashMap[NumFreeOpsHash.Hash] = std::make_pair(1, Lane);
} else if (NumFreeOpsHash.NumOfAPOs == Min &&
NumFreeOpsHash.NumOpsWithSameOpcodeParent == SameOpNumber) {
- auto *It = HashMap.find(NumFreeOpsHash.Hash);
- if (It == HashMap.end())
- HashMap[NumFreeOpsHash.Hash] = std::make_pair(1, Lane);
- else
+ auto [It, Inserted] =
+ HashMap.try_emplace(NumFreeOpsHash.Hash, 1, Lane);
+ if (!Inserted)
++It->second.first;
}
}
More information about the llvm-commits
mailing list