[llvm] [Transforms] Avoid repeated hash lookups (NFC) (PR #110400)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 28 19:05:05 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/110400.diff
1 Files Affected:
- (modified) llvm/include/llvm/Transforms/Utils/SampleProfileInference.h (+3-2)
``````````diff
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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/110400
More information about the llvm-commits
mailing list