Skip to content

Conversation

kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot llvmbot added PGO Profile Guided Optimizations llvm:transforms labels Sep 29, 2024
@llvmbot
Copy link
Member

llvmbot commented Sep 29, 2024

@llvm/pr-subscribers-pgo

@llvm/pr-subscribers-llvm-transforms

Author: Kazu Hirata (kazutakahirata)

Changes

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 --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;

@kazutakahirata kazutakahirata force-pushed the cleanup_001_repeated_hash_SampleProfileInference branch from 9ebf43d to f2410d1 Compare September 29, 2024 02:51
Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kazutakahirata kazutakahirata merged commit 76f2fa8 into llvm:main Sep 29, 2024
8 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_repeated_hash_SampleProfileInference branch September 29, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:transforms PGO Profile Guided Optimizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants