[llvm] 76f2fa8 - [Transforms] Avoid repeated hash lookups (NFC) (#110400)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 29 08:55:06 PDT 2024
Author: Kazu Hirata
Date: 2024-09-29T08:55:03-07:00
New Revision: 76f2fa8163e406914996b7c3bce127ee585fd3f7
URL: https://github.com/llvm/llvm-project/commit/76f2fa8163e406914996b7c3bce127ee585fd3f7
DIFF: https://github.com/llvm/llvm-project/commit/76f2fa8163e406914996b7c3bce127ee585fd3f7.diff
LOG: [Transforms] Avoid repeated hash lookups (NFC) (#110400)
Added:
Modified:
llvm/include/llvm/Transforms/Utils/SampleProfileInference.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/Utils/SampleProfileInference.h b/llvm/include/llvm/Transforms/Utils/SampleProfileInference.h
index b4ea1ad840f9d9..7231e45fe8eb72 100644
--- a/llvm/include/llvm/Transforms/Utils/SampleProfileInference.h
+++ b/llvm/include/llvm/Transforms/Utils/SampleProfileInference.h
@@ -247,9 +247,10 @@ FlowFunction SampleProfileInference<BT>::createFlowFunction(
// Create FlowBlocks
for (const auto *BB : BasicBlocks) {
FlowBlock Block;
- if (SampleBlockWeights.contains(BB)) {
+ auto It = SampleBlockWeights.find(BB);
+ if (It != SampleBlockWeights.end()) {
Block.HasUnknownWeight = false;
- Block.Weight = SampleBlockWeights[BB];
+ Block.Weight = It->second;
} else {
Block.HasUnknownWeight = true;
Block.Weight = 0;
More information about the llvm-commits
mailing list